Merge branch 'main' of http://118.182.97.76:3000/admin/zhyc-sheep-ui
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入羊只耳号" clearable @keyup.enter="getList" />
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号分隔" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="技术员" prop="technical">
|
||||
<el-input v-model="queryParams.technical" placeholder="请输入技术员" clearable />
|
||||
@@ -27,7 +27,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 3. 列表 -->
|
||||
<el-table v-loading="loading" :data="dewormList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" :data="dewormList" @selection-change="handleSelectionChange" max-height="650px"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="羊只耳号" align="center" prop="sheepNo" />
|
||||
@@ -531,6 +531,7 @@
|
||||
|
||||
/* ------------------ 初始化 ------------------ */
|
||||
onMounted(() => {
|
||||
|
||||
getList()
|
||||
getBarns()
|
||||
listPrescription({ status: 1, persType: 1 }).then(res => {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只" prop="sheepId">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入羊只耳号" clearable />
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号隔开" clearable />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="疾病类型" prop="diseasePid">
|
||||
@@ -64,7 +64,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="diagnosisList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" :data="diagnosisList" @selection-change="handleSelectionChange" max-height="650px"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="耳号" align="center" prop="sheepNo" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 查询区 -->
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
|
||||
@@ -9,17 +10,17 @@
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }" value-key="id" placeholder="请选择"
|
||||
check-strictly />
|
||||
</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="['disease:disease:add']">新增</el-button>
|
||||
v-hasPermi="['biosafety:disease:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="toggleExpandAll">展开/折叠</el-button>
|
||||
@@ -27,6 +28,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table v-if="refreshTable" v-loading="loading" :data="diseaseList" row-key="id"
|
||||
:default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column label="名称" prop="name" />
|
||||
@@ -34,32 +36,38 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['disease:disease:edit']">修改</el-button>
|
||||
v-hasPermi="['biosafety:disease:edit']">修改</el-button>
|
||||
<el-button v-if="scope.row.pid === 0" link type="primary" icon="Plus" @click="handleAdd(scope.row)"
|
||||
v-hasPermi="['disease:disease:add']">
|
||||
新增
|
||||
</el-button>
|
||||
v-hasPermi="['biosafety:disease:add']">新增</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['disease:disease:remove']">删除</el-button>
|
||||
v-hasPermi="['biosafety:disease:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改疾病对话框 -->
|
||||
<!-- 新增/修改弹窗 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="diseaseRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form ref="diseaseRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="desc">
|
||||
<el-input v-model="form.desc" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="pid">
|
||||
|
||||
<!-- 新增:是否为疾病大类 -->
|
||||
<el-form-item label="疾病大类" prop="isRoot">
|
||||
<el-switch v-model="form.isRoot" active-text="是" inactive-text="否" @change="onRootChange" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- 父级选择(仅当 isRoot=false 时显示) -->
|
||||
<el-form-item v-if="!form.isRoot" label="上级疾病" prop="pid">
|
||||
<el-tree-select v-model="form.pid" :data="diseaseOptions"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }" value-key="id" placeholder="请选择"
|
||||
check-strictly />
|
||||
check-strictly clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
@@ -71,145 +79,143 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Disease">
|
||||
import { listDisease, getDisease, delDisease, addDisease, updateDisease } from "@/api/biosafety/disease"
|
||||
import { listDisease, getDisease, delDisease, addDisease, updateDisease } from '@/api/biosafety/disease'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
/* 响应式数据 */
|
||||
const diseaseList = ref([])
|
||||
const diseaseOptions = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const title = ref("")
|
||||
const title = ref('')
|
||||
const isExpandAll = ref(true)
|
||||
const refreshTable = ref(true)
|
||||
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
form: {
|
||||
id: null,
|
||||
name: null,
|
||||
desc: null,
|
||||
pid: null,
|
||||
isRoot: true // 新增字段:true 表示作为根节点
|
||||
},
|
||||
queryParams: {
|
||||
name: null,
|
||||
desc: null,
|
||||
pid: null
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询疾病列表 */
|
||||
/* 事件函数 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listDisease(queryParams.value).then(response => {
|
||||
|
||||
diseaseList.value = proxy.handleTree(response.data, "id", "pid")
|
||||
listDisease(queryParams.value).then(res => {
|
||||
diseaseList.value = proxy.handleTree(res.data, 'id', 'pid')
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询疾病下拉树结构 */
|
||||
function getTreeselect() {
|
||||
listDisease().then(response => {
|
||||
diseaseOptions.value = response.data.filter(item => item.pid === 0)
|
||||
listDisease().then(res => {
|
||||
diseaseOptions.value = res.data.filter(item => item.pid === 0)
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
name: null,
|
||||
desc: null,
|
||||
pid: null
|
||||
pid: null,
|
||||
isRoot: true
|
||||
}
|
||||
proxy.resetForm("diseaseRef")
|
||||
proxy.resetForm('diseaseRef')
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd(row) {
|
||||
reset()
|
||||
getTreeselect()
|
||||
if (row != null && row.id) {
|
||||
if (row && row.id) {
|
||||
form.value.pid = row.id
|
||||
form.value.isRoot = false
|
||||
} else {
|
||||
form.value.pid = 0
|
||||
form.value.isRoot = true
|
||||
}
|
||||
open.value = true
|
||||
title.value = "添加疾病"
|
||||
title.value = '添加疾病'
|
||||
}
|
||||
|
||||
/** 展开/折叠操作 */
|
||||
function toggleExpandAll() {
|
||||
refreshTable.value = false
|
||||
isExpandAll.value = !isExpandAll.value
|
||||
nextTick(() => {
|
||||
refreshTable.value = true
|
||||
})
|
||||
nextTick(() => (refreshTable.value = true))
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
async function handleUpdate(row) {
|
||||
reset()
|
||||
await getTreeselect()
|
||||
if (row != null) {
|
||||
form.value.pid = row.pid
|
||||
}
|
||||
getDisease(row.id).then(response => {
|
||||
form.value = response.data
|
||||
getDisease(row.id).then(res => {
|
||||
Object.assign(form.value, res.data)
|
||||
// 根据 pid 判断是否为根节点
|
||||
form.value.isRoot = !form.value.pid
|
||||
open.value = true
|
||||
title.value = "修改疾病"
|
||||
title.value = '修改疾病'
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function onRootChange(val) {
|
||||
// 切换时清空已选 pid
|
||||
if (val) form.value.pid = 0
|
||||
else form.value.pid = null
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs["diseaseRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateDisease(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addDisease(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
proxy.$refs.diseaseRef.validate(valid => {
|
||||
if (!valid) return
|
||||
// 若作为根节点,强制 pid=0
|
||||
if (form.value.isRoot) form.value.pid = 0
|
||||
const api = form.value.id ? updateDisease : addDisease
|
||||
api(form.value).then(() => {
|
||||
proxy.$modal.msgSuccess(form.value.id ? '修改成功' : '新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
proxy.$modal.confirm('是否确认删除疾病' + row.name + '的数据项?').then(function () {
|
||||
return delDisease(row.id)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
proxy.$modal.confirm(`是否确认删除疾病"${row.name}"的数据项?`)
|
||||
.then(() => delDisease(row.id))
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => { })
|
||||
}
|
||||
|
||||
/* 初始化 */
|
||||
getTreeselect()
|
||||
getList()
|
||||
</script>
|
||||
|
||||
</script>
|
||||
@@ -41,7 +41,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="disinfectList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="disinfectList" @selection-change="handleSelectionChange" max-height="650px">
|
||||
<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">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入羊只耳号" clearable @keyup.enter="getList" />
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号隔开" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="技术员" prop="technical">
|
||||
<el-input v-model="queryParams.technical" placeholder="请输入技术员" clearable />
|
||||
@@ -27,9 +27,9 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 3. 列表 -->
|
||||
<el-table v-loading="loading" :data="dewormList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" :data="dewormList" @selection-change="handleSelectionChange" max-height="650px"
|
||||
@sort-change="handleSortChange">
|
||||
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="羊只耳号" align="center" prop="sheepNo" />
|
||||
<el-table-column label="品种" align="center" prop="variety" />
|
||||
<el-table-column label="羊只类别" align="center" prop="sheepType" />
|
||||
@@ -44,7 +44,6 @@
|
||||
<el-table-column label="繁殖状态" align="center" prop="breed" />
|
||||
|
||||
<el-table-column label="技术员" align="center" prop="technical" />
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="保健日期" align="center" prop="datetime" width="180">
|
||||
<template #default="scope">{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入羊只耳号" clearable @keyup.enter="getList" />
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号隔开" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="技术员" prop="technical">
|
||||
<el-input v-model="queryParams.technical" placeholder="请输入技术员" clearable />
|
||||
@@ -27,7 +27,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 3. 列表 -->
|
||||
<el-table v-loading="loading" :data="dewormList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" :data="dewormList" @selection-change="handleSelectionChange" max-height="650px"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
|
||||
@@ -26,20 +26,20 @@
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['system:medicine:add']">新增</el-button>
|
||||
v-hasPermi="['biosafety:medicine:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['system:medicine:edit']">修改</el-button>
|
||||
v-hasPermi="['biosafety:medicine:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['system:medicine:remove']">删除</el-button>
|
||||
v-hasPermi="['biosafety:medicine:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="medicineList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="medicineList" @selection-change="handleSelectionChange" max-height="650px">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="药品编号" align="center" prop="medica" />
|
||||
<el-table-column label="药品名称" align="center" prop="name" />
|
||||
@@ -49,9 +49,9 @@
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:medicine:edit']">修改</el-button>
|
||||
v-hasPermi="['biosafety:medicine:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:medicine:remove']">删除</el-button>
|
||||
v-hasPermi="['biosafety:medicine:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -239,7 +239,7 @@ function handleDelete(row) {
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('system/medicine/export', { ...queryParams.value }, `药品_${new Date().getTime()}.xlsx`)
|
||||
proxy.download('biosafety/medicine/export', { ...queryParams.value }, `药品_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="prescriptionList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="prescriptionList" @selection-change="handleSelectionChange" max-height="650px">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="处方编号" align="center" prop="no" />
|
||||
<el-table-column label="处方名称" align="center" prop="name" />
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
<el-option v-for="i in quarantineItems" :key="i.value" :label="i.label" :value="i.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号隔开" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="采样员" prop="sampler">
|
||||
<el-input v-model="queryParams.sampler" placeholder="请输入采样员名字" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
@@ -21,6 +23,7 @@
|
||||
<el-input v-model="queryParams.quarOfficer" placeholder="请输入检疫员名字" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="羊只类型" prop="sheepType">
|
||||
<el-select v-model="queryParams.sheepType" placeholder="请选择" filterable clearable style="width: 150px">
|
||||
<el-option v-for="i in sheepTypes" :key="i.value" :label="i.makeLabelFormatter" :value="i.label" />
|
||||
@@ -42,18 +45,18 @@
|
||||
<!-- 按钮行 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['bisosafety:quarantine:add']">新增</el-button>
|
||||
v-hasPermi="['biosafety:quarantine:add']">新增</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['bisosafety:quarantine:edit']">修改</el-button>
|
||||
v-hasPermi="['biosafety:quarantine:edit']">修改</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['bisosafety:quarantine:remove']">删除</el-button>
|
||||
v-hasPermi="['biosafety:quarantine:remove']">删除</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['bisosafety:quarantine:export']">导出</el-button>
|
||||
v-hasPermi="['biosafety:quarantine:export']">导出</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table v-loading="loading" :data="quarantineList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" :data="quarantineList" @selection-change="handleSelectionChange" max-height="600px"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
@@ -87,11 +90,11 @@
|
||||
<el-table-column label="操作" align="center" width="200" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['bisosafety:quarantine:edit']">检疫</el-button>
|
||||
v-hasPermi="['biosafety:quarantine:edit']">检疫</el-button>
|
||||
<el-button v-if="String(scope.row.result) === '1'" link type="success"
|
||||
@click="gotoTreatment(scope.row)">治疗</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['bisosafety:quarantine:remove']">删除</el-button>
|
||||
v-hasPermi="['biosafety:quarantine:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<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="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入羊只耳号" clearable />
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号隔开" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="治疗状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择治疗状态" style="width: 120px;">
|
||||
@@ -45,7 +45,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="treatmentList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" :data="treatmentList" @selection-change="handleSelectionChange" max-height="650px"
|
||||
@sort-change="handleSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
<el-date-picker v-model="daterangeCreateTime" type="daterange" range-separator="-" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="羊只耳号" clearable @keyup.enter="handleQuery" />
|
||||
<el-form-item label="羊只耳号" prop="sheepNo">
|
||||
<el-input v-model="queryParams.sheepNo" placeholder="请输入耳号,多个用逗号隔开" clearable @keyup.enter="getList" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="使用名称" prop="name">
|
||||
@@ -48,7 +47,7 @@
|
||||
</el-row>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-loading="loading" :data="usageList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="usageList" @selection-change="handleSelectionChange" max-height="650px">
|
||||
<el-table-column label="使用时间" align="center" prop="datetime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="FeedListList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" height="1000px" :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" />
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="FeedPlanList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" height="1000px" :data="FeedPlanList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="创建日期" align="center" prop="createDate" />
|
||||
<el-table-column label="配方编码" align="center" prop="formulaId" />
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="FeedStatisticList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" height="1000px" :data="FeedStatisticList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="UID" align="center" prop="id" />
|
||||
<el-table-column label="配方编号" align="center" prop="formulaId" />
|
||||
@@ -201,7 +201,7 @@
|
||||
import { listFeedStatistic, getFeedStatistic, delFeedStatistic, addFeedStatistic, updateFeedStatistic, initFeedStatistic } from "@/api/feed/FeedStatistic"
|
||||
import { listFormulaManagement } from "@/api/feed/FormulaManagement"
|
||||
import { listSheepfold } from "@/api/produce/manage_sheep/trans_group.js";
|
||||
import { listMaterial } from "@/api/feed/Material"
|
||||
import { listMaterial } from "@/api/feed/material"
|
||||
import { ref } from "vue";
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@@ -263,10 +263,12 @@
|
||||
const materialQueryParams = ref({
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
isGranular: null
|
||||
isGranular: null,
|
||||
pageNum: 1,
|
||||
pageSize: 99999
|
||||
})
|
||||
function getMaterials() {
|
||||
listMaterial(materialQueryParams).then(response => {
|
||||
listMaterial(materialQueryParams.value).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
materials.value = response.rows.map(item => ({
|
||||
value: item.materialId,
|
||||
@@ -282,7 +284,7 @@
|
||||
|
||||
// 从后端获取数据并按isGranular分组
|
||||
function getGroupMaterials() {
|
||||
listMaterial(materialQueryParams).then(response => {
|
||||
listMaterial(materialQueryParams.value).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
|
||||
// 根据material_type分组数据
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="FormulaListList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" height="1000px" :data="FormulaListList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="code" />
|
||||
<el-table-column label="配方编号" align="center" prop="formulaId" />
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="FormulaManagementList">
|
||||
<el-table v-loading="loading" height="1000px" :data="FormulaManagementList">
|
||||
<!-- 表中表展示子配方 -->
|
||||
<el-table-column type="expand" @expand-change="handleExpandChange">
|
||||
<template #default="props">
|
||||
@@ -149,14 +149,14 @@
|
||||
<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="名称" 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" sortable/>
|
||||
<el-table-column label="比例" align="center" prop="ratio" sortable />
|
||||
<el-table-column label="类型" prop="isSupplement" align="center">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="materialType" :value="scope.row.isSupplement" />
|
||||
@@ -279,492 +279,496 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listFormulaManagement, getFormulaManagement, delFormulaManagement, addFormulaManagement, updateFormulaManagement } from "@/api/feed/FormulaManagement"
|
||||
import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
|
||||
import { listFormulaList, getFormulaList, delFormulaList, addFormulaList, updateFormulaList } from "@/api/feed/FormulaList"
|
||||
import { listMaterial } from "@/api/feed/Material"
|
||||
import { fa } from "element-plus/es/locales.mjs"
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { pres_status } = proxy.useDict('pres_status')
|
||||
// Data and refs
|
||||
const FormulaManagementList = ref([])
|
||||
const showFormulaManagementList = ref([])
|
||||
const FormulaDetailList = 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 expandedRows = ref([]) // Track expanded rows
|
||||
const isView = ref(false)
|
||||
import { listFormulaManagement, getFormulaManagement, delFormulaManagement, addFormulaManagement, updateFormulaManagement } from "@/api/feed/FormulaManagement"
|
||||
import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
|
||||
import { listFormulaList, getFormulaList, delFormulaList, addFormulaList, updateFormulaList } from "@/api/feed/FormulaList"
|
||||
import { listMaterial } from "@/api/feed/material"
|
||||
import { fa } from "element-plus/es/locales.mjs"
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { pres_status } = proxy.useDict('pres_status')
|
||||
// Data and refs
|
||||
const FormulaManagementList = ref([])
|
||||
const showFormulaManagementList = ref([])
|
||||
const FormulaDetailList = 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 expandedRows = ref([]) // Track expanded rows
|
||||
const isView = ref(false)
|
||||
|
||||
/**
|
||||
* add : 添加配方
|
||||
* update : 修改配方
|
||||
*/
|
||||
const operationType = ref("") // 操作类型:add 或 update
|
||||
// 控制批号是否可编辑
|
||||
const BatchIdEditable = ref(false)
|
||||
const FormulaIdEditable = ref(false)
|
||||
// 原料下拉列表
|
||||
const materials = ref([])
|
||||
// 原料类型
|
||||
const materialType = [
|
||||
{ value: '1', label: '补饲原料' },
|
||||
{ value: '0', label: '原料' }
|
||||
]
|
||||
// 原料类型字典
|
||||
const { material_type } = proxy.useDict('material_type')
|
||||
console.log("material_type: ", material_type);
|
||||
const useStaus = [
|
||||
{ value: '1', label: '启用' },
|
||||
{ value: '0', label: '停用' }
|
||||
]
|
||||
const checkedSwPresDetail = ref([]) // 子表选中的行序号数组
|
||||
/**
|
||||
* add : 添加配方
|
||||
* update : 修改配方
|
||||
*/
|
||||
const operationType = ref("") // 操作类型:add 或 update
|
||||
// 控制批号是否可编辑
|
||||
const BatchIdEditable = ref(false)
|
||||
const FormulaIdEditable = ref(false)
|
||||
// 原料下拉列表
|
||||
const materials = ref([])
|
||||
// 原料类型
|
||||
const materialType = [
|
||||
{ value: '1', label: '补饲原料' },
|
||||
{ value: '0', label: '原料' }
|
||||
]
|
||||
// 原料类型字典
|
||||
const { material_type } = proxy.useDict('material_type')
|
||||
console.log("material_type: ", material_type);
|
||||
const useStaus = [
|
||||
{ value: '1', label: '启用' },
|
||||
{ value: '0', label: '停用' }
|
||||
]
|
||||
const checkedSwPresDetail = ref([]) // 子表选中的行序号数组
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
feedStage: null,
|
||||
batchId: null,
|
||||
},
|
||||
rules: {
|
||||
formulaId: [
|
||||
{ required: true, message: "配方编号不能为空", trigger: "blur" }
|
||||
],
|
||||
feedStage: [
|
||||
{ required: true, message: "饲养阶段不能为空", trigger: "blur" }
|
||||
],
|
||||
ratio: [
|
||||
{ required: true, message: "比例不能为空", trigger: "blur" },
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
|
||||
const formulaForm = ref({
|
||||
materialId: '',
|
||||
materialName: '',
|
||||
ratio: '',
|
||||
isGranular: false
|
||||
})
|
||||
const formulaListOpen = ref(false)
|
||||
/** 查询配方管理列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listFormulaManagement(queryParams.value).then(response => {
|
||||
FormulaManagementList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
console.log("配方管理列表数据:", FormulaManagementList.value)
|
||||
})
|
||||
}
|
||||
|
||||
// 处理展开行的变化
|
||||
function handleExpandChange(row, expandedRows) {
|
||||
// 收起其他行
|
||||
expandedRows.forEach(r => {
|
||||
if (r !== row) {
|
||||
mainTable.value.toggleRowExpansion(r, false)
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
feedStage: null,
|
||||
batchId: null,
|
||||
},
|
||||
rules: {
|
||||
formulaId: [
|
||||
{ required: true, message: "配方编号不能为空", trigger: "blur" }
|
||||
],
|
||||
feedStage: [
|
||||
{ required: true, message: "饲养阶段不能为空", trigger: "blur" }
|
||||
],
|
||||
ratio: [
|
||||
{ required: true, message: "比例不能为空", trigger: "blur" },
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
// 如果是展开状态,刷新子表数据
|
||||
const isExpanded = expandedRows.includes(row)
|
||||
if (isExpanded) {
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
|
||||
const formulaForm = ref({
|
||||
materialId: '',
|
||||
materialName: '',
|
||||
ratio: '',
|
||||
isGranular: false
|
||||
})
|
||||
const formulaListOpen = ref(false)
|
||||
/** 查询配方管理列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
getList();
|
||||
listFormulaManagement(queryParams.value).then(response => {
|
||||
FormulaManagementList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
console.log("配方管理列表数据:", FormulaManagementList.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
formulaListOpen.value = false
|
||||
formulaFormReset()
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
formulaId: null,
|
||||
feedStage: null,
|
||||
batchId: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("FormulaManagementRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.formulaId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAddFormulatemplate() {
|
||||
formulaFormReset()
|
||||
reset()
|
||||
operationType.value = "add"
|
||||
// 模板禁用批号编辑
|
||||
BatchIdEditable.value = false
|
||||
// 添加模板时配方编号可编辑
|
||||
FormulaIdEditable.value = true
|
||||
isView.value = false
|
||||
// 初始化表单
|
||||
showFormulaManagementList.value = {
|
||||
formulaId: null,
|
||||
// 模板批号为 0
|
||||
batchId: "0",
|
||||
feedStage: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: '1', // 默认启用
|
||||
remark: null,
|
||||
sgFormulaList: [{
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
}]
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "添加配方管理模板"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleFormulaTemplateUpdate(row) {
|
||||
reset()
|
||||
operationType.value = "update"
|
||||
const _id = row.formulaId || ids.value
|
||||
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||
FormulaIdEditable.value = false // 修改时配方编号不可编辑
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "修改处方"
|
||||
isView.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.formulaId != null) {
|
||||
updateFormulaManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addFormulaManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
// 处理展开行的变化
|
||||
function handleExpandChange(row, expandedRows) {
|
||||
// 收起其他行
|
||||
expandedRows.forEach(r => {
|
||||
if (r !== row) {
|
||||
mainTable.value.toggleRowExpansion(r, false)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _formulaIds = row.formulaId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除配方管理编号为"' + _formulaIds + '"的数据项?').then(function () {
|
||||
return delFormulaManagement(_formulaIds)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** ================= 配方列表操作 ================= */
|
||||
function handleAddSgFormulaList(row) {
|
||||
formulaFormReset()
|
||||
reset()
|
||||
operationType.value = "add"
|
||||
BatchIdEditable.value = true
|
||||
FormulaIdEditable.value = false
|
||||
isView.value = false
|
||||
console.log(row.sgFormulaList)
|
||||
// 初始化表单
|
||||
showFormulaManagementList.value = {
|
||||
formulaId: row.formulaId || null,
|
||||
batchId: null,
|
||||
feedStage: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: '1', // 默认启用
|
||||
remark: null,
|
||||
sgFormulaList: row.sgFormulaList || [{
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
}]
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "添加配方"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleFormulaUpdate(row) {
|
||||
formulaFormReset()
|
||||
const _code = row.code || ids.value
|
||||
getFormulaList(_code).then(response => {
|
||||
formulaForm.value = response.data
|
||||
if (formulaForm.value.isGranular === "1") {
|
||||
formulaForm.value.isGranular = true
|
||||
} else {
|
||||
formulaForm.value.isGranular = false
|
||||
}
|
||||
console.log("formulaForm: ", formulaForm.value)
|
||||
formulaListOpen.value = true
|
||||
FormulaIdEditable.value = false
|
||||
title.value = "修改配方列表"
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleFormulaDelete(row) {
|
||||
const _codes = row.formulaId + "/" + row.batchId
|
||||
proxy.$modal.confirm('是否确认删除配方列表编号为"' + _codes + '"的数据项?').then(function () {
|
||||
return delFormulaManagement(_codes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitFormulaListForm() {
|
||||
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (showFormulaManagementList.value.formulaId != null && operationType.value === "update") {
|
||||
updateFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
formulaListOpen.value = false
|
||||
getList()
|
||||
})
|
||||
} else if (operationType.value === "add" && showFormulaManagementList.value.formulaId != null && showFormulaManagementList.value.batchId != null) {
|
||||
addFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
formulaListOpen.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 原料下拉选择变化时,更新对应的原料名称
|
||||
function handleMaterialChange(row, selectedValue) {
|
||||
const selectedItem = this.materials.find(item => item.value === selectedValue);
|
||||
if (selectedItem) {
|
||||
// materialName 也在 row 中
|
||||
row.materialName = selectedItem.label;
|
||||
row.isGranular = selectedItem.isGranular; // 更新 isGranular
|
||||
row.isSupplement = selectedItem.isSupplement; // 更新 isSupplement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
* 根据 id 拉取单条记录及子表数据,弹窗只读展示
|
||||
*/
|
||||
function handleView(row) {
|
||||
reset()
|
||||
const _id = row.formulaId || ids.value
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
title.value = "配方详情"
|
||||
isView.value = true
|
||||
formulaListOpen.value = true
|
||||
console.log("handleView showFormulaManagementList: ", showFormulaManagementList.value);
|
||||
console.log("handleView response: ", response);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改按钮
|
||||
* 与查看详情共用接口,但弹窗可编辑
|
||||
*/
|
||||
function handleFormulaDetailUpdate(row) {
|
||||
reset()
|
||||
operationType.value = "update"
|
||||
const _id = row.formulaId || ids.value
|
||||
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "修改配方"
|
||||
isView.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 添加项
|
||||
function handleAddSgFormulaListDetail() {
|
||||
showFormulaManagementList.value.sgFormulaList.push({
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
})
|
||||
}
|
||||
// 删除项
|
||||
function deleteFormulaListDetail(row) {
|
||||
const index = showFormulaManagementList.value.sgFormulaList.findIndex(item => item.index === row.index)
|
||||
if (index !== -1) {
|
||||
showFormulaManagementList.value.sgFormulaList.splice(index, 1)
|
||||
}
|
||||
}
|
||||
// 表单重置
|
||||
function formulaFormReset() {
|
||||
form.value = {
|
||||
code: null,
|
||||
formulaId: null,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: null,
|
||||
isSupplement: null
|
||||
}
|
||||
proxy.resetForm("FormulaListRef")
|
||||
}
|
||||
|
||||
// 原料列表查询参数
|
||||
const materialQueryParams = ref({
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
isGranular: null
|
||||
})
|
||||
function getMaterials() {
|
||||
listMaterial(materialQueryParams).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
materials.value = response.rows.map(item => ({
|
||||
value: item.materialId,
|
||||
label: item.materialName,
|
||||
isGranular: item.isGranular,
|
||||
isSupplement: "0" // 默认补饲原料为 0
|
||||
}))
|
||||
console.log("原料列表:", materials.value)
|
||||
})
|
||||
}
|
||||
|
||||
/** ================== 分组下拉列表部分 ======================== */
|
||||
const groupedMaterials = ref([]) // 存储分组后的原料数据
|
||||
|
||||
// 从后端获取数据并按isGranular分组
|
||||
function getGroupMaterials() {
|
||||
listMaterial(materialQueryParams).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
|
||||
// 根据material_type分组数据
|
||||
const groups = material_type.value.map(type => ({
|
||||
label: type.label,
|
||||
options: []
|
||||
}))
|
||||
|
||||
// 遍历原料数据,根据isGranular字段分组
|
||||
response.rows.forEach(item => {
|
||||
const group = groups.find(group => group.label === material_type.value.find(type => type.value === item.isGranular).label)
|
||||
group.options.push({
|
||||
value: item.materialId,
|
||||
label: item.materialName
|
||||
})
|
||||
})
|
||||
|
||||
// 将分组后的数据赋值给groupedMaterials
|
||||
groupedMaterials.value = groups
|
||||
console.log("分组后的原料列表:", groupedMaterials.value)
|
||||
// 如果是展开状态,刷新子表数据
|
||||
const isExpanded = expandedRows.includes(row)
|
||||
if (isExpanded) {
|
||||
loading.value = true
|
||||
getList();
|
||||
}
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
formulaListOpen.value = false
|
||||
formulaFormReset()
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
formulaId: null,
|
||||
feedStage: null,
|
||||
batchId: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("FormulaManagementRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.formulaId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAddFormulatemplate() {
|
||||
formulaFormReset()
|
||||
reset()
|
||||
operationType.value = "add"
|
||||
// 模板禁用批号编辑
|
||||
BatchIdEditable.value = false
|
||||
// 添加模板时配方编号可编辑
|
||||
FormulaIdEditable.value = true
|
||||
isView.value = false
|
||||
// 初始化表单
|
||||
showFormulaManagementList.value = {
|
||||
formulaId: null,
|
||||
// 模板批号为 0
|
||||
batchId: "0",
|
||||
feedStage: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: '1', // 默认启用
|
||||
remark: null,
|
||||
sgFormulaList: [{
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
}]
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "添加配方管理模板"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleFormulaTemplateUpdate(row) {
|
||||
reset()
|
||||
operationType.value = "update"
|
||||
const _id = row.formulaId || ids.value
|
||||
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||
FormulaIdEditable.value = false // 修改时配方编号不可编辑
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "修改处方"
|
||||
isView.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.formulaId != null) {
|
||||
updateFormulaManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addFormulaManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _formulaIds = row.formulaId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除配方管理编号为"' + _formulaIds + '"的数据项?').then(function () {
|
||||
return delFormulaManagement(_formulaIds)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** ================= 配方列表操作 ================= */
|
||||
function handleAddSgFormulaList(row) {
|
||||
formulaFormReset()
|
||||
reset()
|
||||
operationType.value = "add"
|
||||
BatchIdEditable.value = true
|
||||
FormulaIdEditable.value = false
|
||||
isView.value = false
|
||||
console.log(row.sgFormulaList)
|
||||
// 初始化表单
|
||||
showFormulaManagementList.value = {
|
||||
formulaId: row.formulaId || null,
|
||||
batchId: null,
|
||||
feedStage: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: '1', // 默认启用
|
||||
remark: null,
|
||||
sgFormulaList: row.sgFormulaList || [{
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
}]
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "添加配方"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleFormulaUpdate(row) {
|
||||
formulaFormReset()
|
||||
const _code = row.code || ids.value
|
||||
getFormulaList(_code).then(response => {
|
||||
formulaForm.value = response.data
|
||||
if (formulaForm.value.isGranular === "1") {
|
||||
formulaForm.value.isGranular = true
|
||||
} else {
|
||||
formulaForm.value.isGranular = false
|
||||
}
|
||||
console.log("formulaForm: ", formulaForm.value)
|
||||
formulaListOpen.value = true
|
||||
FormulaIdEditable.value = false
|
||||
title.value = "修改配方列表"
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleFormulaDelete(row) {
|
||||
const _codes = row.formulaId + "/" + row.batchId
|
||||
proxy.$modal.confirm('是否确认删除配方列表编号为"' + _codes + '"的数据项?').then(function () {
|
||||
return delFormulaManagement(_codes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitFormulaListForm() {
|
||||
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (showFormulaManagementList.value.formulaId != null && operationType.value === "update") {
|
||||
updateFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
formulaListOpen.value = false
|
||||
getList()
|
||||
})
|
||||
} else if (operationType.value === "add" && showFormulaManagementList.value.formulaId != null && showFormulaManagementList.value.batchId != null) {
|
||||
addFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
formulaListOpen.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 原料下拉选择变化时,更新对应的原料名称
|
||||
function handleMaterialChange(row, selectedValue) {
|
||||
const selectedItem = this.materials.find(item => item.value === selectedValue);
|
||||
if (selectedItem) {
|
||||
// materialName 也在 row 中
|
||||
row.materialName = selectedItem.label;
|
||||
row.isGranular = selectedItem.isGranular; // 更新 isGranular
|
||||
row.isSupplement = selectedItem.isSupplement; // 更新 isSupplement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
* 根据 id 拉取单条记录及子表数据,弹窗只读展示
|
||||
*/
|
||||
function handleView(row) {
|
||||
reset()
|
||||
const _id = row.formulaId || ids.value
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
title.value = "配方详情"
|
||||
isView.value = true
|
||||
formulaListOpen.value = true
|
||||
console.log("handleView showFormulaManagementList: ", showFormulaManagementList.value);
|
||||
console.log("handleView response: ", response);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改按钮
|
||||
* 与查看详情共用接口,但弹窗可编辑
|
||||
*/
|
||||
function handleFormulaDetailUpdate(row) {
|
||||
reset()
|
||||
operationType.value = "update"
|
||||
const _id = row.formulaId || ids.value
|
||||
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "修改配方"
|
||||
isView.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 添加项
|
||||
function handleAddSgFormulaListDetail() {
|
||||
showFormulaManagementList.value.sgFormulaList.push({
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
})
|
||||
}
|
||||
// 删除项
|
||||
function deleteFormulaListDetail(row) {
|
||||
const index = showFormulaManagementList.value.sgFormulaList.findIndex(item => item.index === row.index)
|
||||
if (index !== -1) {
|
||||
showFormulaManagementList.value.sgFormulaList.splice(index, 1)
|
||||
}
|
||||
}
|
||||
// 表单重置
|
||||
function formulaFormReset() {
|
||||
form.value = {
|
||||
code: null,
|
||||
formulaId: null,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: null,
|
||||
isSupplement: null
|
||||
}
|
||||
proxy.resetForm("FormulaListRef")
|
||||
}
|
||||
|
||||
// 原料列表查询参数
|
||||
const materialQueryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 30,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
isGranular: null
|
||||
})
|
||||
}
|
||||
function getMaterials() {
|
||||
listMaterial(materialQueryParams.value).then(response => {
|
||||
materials.value = response.rows.map(item => ({
|
||||
value: item.materialId,
|
||||
label: item.materialName,
|
||||
isGranular: item.isGranular,
|
||||
isSupplement: "0" // 默认补饲原料为 0
|
||||
}))
|
||||
console.log("原料列表:", materials.value)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 子表多选回调
|
||||
* 记录被选中的行序号数组
|
||||
*/
|
||||
function handleSgFormulaListDetailSelectionChange(selection) {
|
||||
checkedSwPresDetail.value = selection.map(item => item.index)
|
||||
}
|
||||
/**
|
||||
* 子表行序号计算
|
||||
* 通过 el-table 的 row-class-name 钩子给每一行写入 index(从 1 开始)
|
||||
*/
|
||||
function rowSgFormulaListDetailIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1
|
||||
}
|
||||
/** ================== 分组下拉列表部分 ======================== */
|
||||
const groupedMaterials = ref([]) // 存储分组后的原料数据
|
||||
|
||||
/** ================================= */
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/FormulaManagement/export', {
|
||||
...queryParams.value
|
||||
}, `FormulaManagement_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
// 从后端获取数据并按isGranular分组
|
||||
function getGroupMaterials() {
|
||||
listMaterial(materialQueryParams.value).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
|
||||
// 初始化加载数据
|
||||
getList()
|
||||
// 加载原料列表
|
||||
getMaterials()
|
||||
// 加载分组原料列表
|
||||
getGroupMaterials()
|
||||
const groups = material_type.value.map(type => ({
|
||||
label: type.label,
|
||||
value: type.value,
|
||||
options: []
|
||||
}))
|
||||
console.log("初始化分组:", groups)
|
||||
response.rows.forEach(item => {
|
||||
const group = groups.find(
|
||||
g => String(g.value) === String(item.isGranular)
|
||||
)
|
||||
if (group) {
|
||||
group.options.push({
|
||||
value: item.materialId,
|
||||
label: item.materialName
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 将分组后的数据赋值给groupedMaterials
|
||||
groupedMaterials.value = groups
|
||||
console.log("分组后的原料列表:", groupedMaterials.value)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 子表多选回调
|
||||
* 记录被选中的行序号数组
|
||||
*/
|
||||
function handleSgFormulaListDetailSelectionChange(selection) {
|
||||
checkedSwPresDetail.value = selection.map(item => item.index)
|
||||
}
|
||||
/**
|
||||
* 子表行序号计算
|
||||
* 通过 el-table 的 row-class-name 钩子给每一行写入 index(从 1 开始)
|
||||
*/
|
||||
function rowSgFormulaListDetailIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1
|
||||
}
|
||||
|
||||
/** ================================= */
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/FormulaManagement/export', {
|
||||
...queryParams.value
|
||||
}, `FormulaManagement_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
// 初始化加载数据
|
||||
getList()
|
||||
// 加载原料列表
|
||||
getMaterials()
|
||||
// 加载分组原料列表
|
||||
getGroupMaterials()
|
||||
</script>
|
||||
|
||||
278
src/views/feed/material/index.vue
Normal file
278
src/views/feed/material/index.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="原料编码" prop="materialId">
|
||||
<el-input
|
||||
v-model="queryParams.materialId"
|
||||
placeholder="请输入原料编码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原料名称" prop="materialName">
|
||||
<el-input
|
||||
v-model="queryParams.materialName"
|
||||
placeholder="请输入原料名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="颗粒料" prop="isGranular">
|
||||
<el-select v-model="queryParams.isGranular" placeholder="请选择颗粒料" clearable>
|
||||
<el-option
|
||||
v-for="dict in material_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</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>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['feed:material:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['feed:material:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['feed:material:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['feed:material:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" height="1000px" :data="materialList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="原料编码" align="center" prop="materialId" />
|
||||
<el-table-column label="原料名称" align="center" prop="materialName" />
|
||||
<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 label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['feed:material:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['feed:material: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>
|
||||
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="原料编码" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入原料编码" :disabled="option==='edit'"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入原料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="颗粒料" prop="isGranular">
|
||||
<el-select v-model="form.isGranular" placeholder="请选择颗粒料">
|
||||
<el-option
|
||||
v-for="dict in material_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script setup name="Material">
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/feed/material"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { material_type } = proxy.useDict('material_type')
|
||||
|
||||
const materialList = 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 option = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
isGranular: null
|
||||
},
|
||||
rules: {
|
||||
materialId: [
|
||||
{ required: true, message: "原料编码不能为空", trigger: "blur" }
|
||||
],
|
||||
materialName: [
|
||||
{ required: true, message: "原料名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询原料列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMaterial(queryParams.value).then(response => {
|
||||
materialList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
isGranular: null
|
||||
}
|
||||
proxy.resetForm("materialRef")
|
||||
option.value = ""
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.materialId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加原料"
|
||||
option.value = "add"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _materialId = row.materialId || ids.value
|
||||
option.value = "edit"
|
||||
getMaterial(_materialId).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改原料"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["materialRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (option.value === "edit") {
|
||||
updateMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else if(option.value === "add") {
|
||||
addMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _materialIds = row.materialId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除原料编号为"' + _materialIds + '"的数据项?').then(function() {
|
||||
return delMaterial(_materialIds)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/material/export', {
|
||||
...queryParams.value
|
||||
}, `material_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
@@ -970,6 +970,7 @@
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
:page-sizes="[20, 50, 100, 200, 500, 1000, 2000]"
|
||||
/>
|
||||
|
||||
<!-- 列显示设置对话框 -->
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['variety:variety:add']"
|
||||
v-hasPermi="['base:variety:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@@ -32,7 +32,7 @@
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['variety:variety:edit']"
|
||||
v-hasPermi="['base:variety:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@@ -42,7 +42,7 @@
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['variety:variety:remove']"
|
||||
v-hasPermi="['base:variety:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@@ -51,7 +51,7 @@
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['variety:variety:export']"
|
||||
v-hasPermi="['base:variety:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
@@ -59,12 +59,12 @@
|
||||
|
||||
<el-table v-loading="loading" :data="varietyList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="${comment}" align="center" prop="id" />
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="品种" align="center" prop="variety" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['variety:variety:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['variety:variety:remove']">删除</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['base:variety:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['base:variety:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -95,7 +95,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Variety">
|
||||
import { listVariety, getVariety, delVariety, addVariety, updateVariety } from "@/api/variety/variety"
|
||||
import { listVariety, getVariety, delVariety, addVariety, updateVariety } from "@/api/fileManagement/variety"
|
||||
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@@ -219,7 +219,7 @@ function handleDelete(row) {
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('variety/variety/export', {
|
||||
proxy.download('base/variety/export', {
|
||||
...queryParams.value
|
||||
}, `variety_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
@@ -257,8 +257,6 @@ const GRADE_OPTS = [
|
||||
{ label: 'B', value: 'B' },
|
||||
{ label: 'C', value: 'C' },
|
||||
{ label: 'D', value: 'D' },
|
||||
{ label: '囊胚', value: '囊胚' },
|
||||
{ label: '桑椹胚', value: '桑椹胚' }
|
||||
]
|
||||
|
||||
// 2. 是否性控
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['sperm:sperm:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['frozen:sperm:add']">新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
@@ -33,14 +33,14 @@
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['sperm:sperm:remove']">删除</el-button>
|
||||
v-hasPermi="['frozen:sperm:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['sperm:sperm:export']">导出</el-button>
|
||||
v-hasPermi="['frozen:sperm:export']">导出</el-button>
|
||||
</el-col>
|
||||
<el-button type="warning" plain icon="Close" @click="handleDiscard" :disabled="multiple"
|
||||
v-hasPermi="['sperm:sperm:discard']">废弃</el-button>
|
||||
v-hasPermi="['frozen:sperm:discard']">废弃</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<template #default="scope">
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['sperm:sperm:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['sperm:sperm:remove']">删除</el-button>
|
||||
v-hasPermi="['frozen:sperm:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -9,9 +9,16 @@
|
||||
<el-date-picker v-model="daterangeMeasureDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepfoldId">
|
||||
<el-select v-model="queryParams.sheepfoldId" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||
@@ -33,7 +40,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
@@ -196,7 +209,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Body_measure">
|
||||
import { listBody_measure, getBody_measure, delBody_measure, addBody_measure, updateBody_measure, getSheepTypeList } from "@/api/produce/bodyManage/body_measure"
|
||||
import { listBody_measure, getBody_measure, delBody_measure, addBody_measure, updateBody_measure, getSheepTypeList, searchEarNumbers } from "@/api/produce/bodyManage/body_measure"
|
||||
import { getSheepByManageTags } from "@/api/produce/manage_sheep/changeVariety"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { getVarietyOptions } from '@/api/produce/other/fixHoof'
|
||||
@@ -251,7 +264,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
//查询体尺测量列表
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -340,6 +354,7 @@ function resetQuery() {
|
||||
queryParams.value.varietyId = null;
|
||||
data.varietyName = '';
|
||||
daterangeMeasureDate.value = [];
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
@@ -435,7 +450,20 @@ function loadSheepTypeList() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
getSheepfoldOptions()
|
||||
loadSheepTypeList()
|
||||
@@ -443,3 +471,11 @@ onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.selected-ear-numbers{
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,9 +5,16 @@
|
||||
<el-date-picker v-model="daterangeDatetime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="品种" prop="varietyId">
|
||||
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" clearable style="min-width:150px">
|
||||
@@ -24,7 +31,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
@@ -55,7 +68,7 @@
|
||||
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="体况评分" align="center" prop="score" min-width="100px" sortable/>
|
||||
<el-table-column label="体况评分" align="center" prop="score" min-width="100px" sortable />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" min-width="100px" />
|
||||
<el-table-column label="备注" align="center" prop="comment" min-width="130px" />
|
||||
<el-table-column label="技术员" align="center" prop="technician" />
|
||||
@@ -116,7 +129,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Body_score">
|
||||
import { listBody_score, getBody_score, delBody_score, addBody_score, updateBody_score } from "@/api/produce/bodyManage/body_score"
|
||||
import { listBody_score, getBody_score, delBody_score, addBody_score, updateBody_score ,searchEarNumbers} from "@/api/produce/bodyManage/body_score"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { checkSheepByManageTags, getVarietyOptions } from "@/api/produce/other/fixHoof"
|
||||
import { getCurrentInstance, ref, reactive, toRefs } from 'vue'
|
||||
@@ -173,7 +186,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
/** 查询体况评分列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -264,6 +278,7 @@ function resetQuery() {
|
||||
daterangeDatetime.value = []
|
||||
daterangeCreateTime.value = []
|
||||
queryParams.value.varietyId = null;
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@@ -345,10 +360,31 @@ function loadVarietyOptions() {
|
||||
varietyOptions.value = res.rows;
|
||||
})
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
loadVarietyOptions()
|
||||
getSheepfoldOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.selected-ear-numbers{
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -9,9 +9,16 @@
|
||||
<el-date-picker v-model="daterangeEventDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入耳号搜索" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="品种" prop="varietyId">
|
||||
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" clearable style="min-width:150px">
|
||||
@@ -47,7 +54,13 @@
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="breast_ratingList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="管理耳号" align="center" prop="manageTags" min-width="100px" fixed />
|
||||
@@ -134,7 +147,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Breast_rating">
|
||||
import { listBreast_rating, getBreast_rating, delBreast_rating, addBreast_rating, updateBreast_rating } from "@/api/produce/bodyManage/breast_rating"
|
||||
import { listBreast_rating, getBreast_rating, delBreast_rating, addBreast_rating, updateBreast_rating, searchEarNumbers } from "@/api/produce/bodyManage/breast_rating"
|
||||
import { checkSheepByManageTags, getVarietyOptions } from "@/api/produce/other/fixHoof"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { getCurrentInstance, reactive, ref } from "vue"
|
||||
@@ -190,7 +203,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
/** 查询乳房评分列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -272,6 +286,7 @@ function handleQuery() {
|
||||
function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
daterangeEventDate.value = [];
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@@ -361,10 +376,31 @@ function loadVarietyOptions() {
|
||||
varietyOptions.value = res.rows;
|
||||
})
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
loadVarietyOptions()
|
||||
getSheepfoldOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.selected-ear-numbers {
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -58,11 +58,24 @@
|
||||
<el-input v-model="form.bornWeight" placeholder="请输入出生体重" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="断奶体重(kg)" prop="weaningWeight">
|
||||
<el-input v-model="form.weaningWeight" placeholder="请输入断奶体重" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="出生日期" prop="birthday">
|
||||
<el-date-picker v-model="form.birthday" type="date" placeholder="选择出生日期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="胎次" prop="parity">
|
||||
<el-input-number v-model="form.parity" :min="0" label="胎次" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
@@ -75,14 +88,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="胎次" prop="parity">
|
||||
<el-input-number v-model="form.parity" :min="0" label="胎次" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="品种" prop="varietyId">
|
||||
<el-select v-model="form.varietyId" placeholder="请选择品种" clearable>
|
||||
@@ -90,6 +95,9 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="羊只类别" prop="typeId">
|
||||
<el-select v-model="form.typeId" placeholder="请选择羊只类别" clearable>
|
||||
@@ -97,10 +105,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item label="技术员" prop="technician">
|
||||
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||
@@ -130,7 +134,6 @@
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button type="info" @click="downloadTemplate">下载模板</el-button>
|
||||
<el-button type="primary" @click="submitUpload">确 定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -162,7 +165,8 @@ const form = ref({
|
||||
typeId: null,
|
||||
joinDate: '',
|
||||
comment: '',
|
||||
technician: ''
|
||||
technician: '',
|
||||
weaningWeight: ''
|
||||
})
|
||||
const formRef = ref(null)
|
||||
const sheepfoldOptions = ref([])
|
||||
@@ -176,6 +180,7 @@ const rules = {
|
||||
ranchId: [{ required: true, message: '请选择牧场', trigger: 'change' }],
|
||||
sheepfold: [{ required: true, message: '请选择羊舍', trigger: 'change' }],
|
||||
bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'change' }],
|
||||
weaningWeight: [{ required: true, message: '请输入断奶体重', trigger: 'blur' }],
|
||||
birthday: [{ required: true, message: '请选择出生日期', trigger: 'change' }],
|
||||
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
|
||||
varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }],
|
||||
@@ -237,13 +242,6 @@ function handleRanchChange(ranchId) {
|
||||
});
|
||||
}
|
||||
|
||||
//羊舍列表
|
||||
//function getSheepfoldOptions() {
|
||||
// listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
// sheepfoldOptions.value = res.rows || []
|
||||
// })
|
||||
//}
|
||||
|
||||
//品种列表
|
||||
function getVarietyOptions() {
|
||||
request({
|
||||
@@ -330,7 +328,7 @@ function resetForm() {
|
||||
technician: ''
|
||||
}
|
||||
}
|
||||
//导出
|
||||
//下载模板
|
||||
function handleExportForm() {
|
||||
exportSheepForm(form.value).then(res => {
|
||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||
@@ -350,15 +348,6 @@ const headers = ref({ Authorization: 'Bearer ' + getToken() })
|
||||
function handleImport() {
|
||||
importOpen.value = true
|
||||
}
|
||||
function downloadTemplate() {
|
||||
request({ url: '/produce/manage_sheep/add_sheep/importTemplate', method: 'get', responseType: 'blob' }).then(res => {
|
||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||
const link = document.createElement('a')
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = `羊只模板_${Date.now()}.xlsx`
|
||||
link.click()
|
||||
})
|
||||
}
|
||||
function submitUpload() {
|
||||
uploadRef.value?.submit()
|
||||
}
|
||||
@@ -382,7 +371,6 @@ function handleImportError(err) {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// getSheepfoldOptions()
|
||||
loadSheepTypeList()
|
||||
loadRanchList()
|
||||
getVarietyOptions()
|
||||
|
||||
@@ -5,9 +5,16 @@
|
||||
<el-date-picker v-model="daterangeEventDate" type="daterange" range-separator="-" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="新备注" prop="newComment">
|
||||
<el-input v-model="queryParams.newComment" placeholder="请输入新备注" clearable @keyup.enter="handleQuery"
|
||||
@@ -27,7 +34,17 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选择耳号:</span>
|
||||
<el-tag
|
||||
v-for="tag in queryParams.manageTagsList"
|
||||
:key="tag"
|
||||
closable
|
||||
@close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
@@ -111,7 +128,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="ChangeComment">
|
||||
import { listChangeComment, getChangeComment, delChangeComment, addChangeComment, updateChangeComment } from "@/api/produce/manage_sheep/changeComment"
|
||||
import { listChangeComment, getChangeComment, delChangeComment, addChangeComment, updateChangeComment ,searchEarNumbers} from "@/api/produce/manage_sheep/changeComment"
|
||||
import { getSheepByManageTags } from "@/api/produce/manage_sheep/changeVariety"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
|
||||
@@ -158,7 +175,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
/** 查询改备注列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -234,6 +252,7 @@ function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
daterangeEventDate.value = []
|
||||
queryParams.value.sheepfoldId = null
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@@ -318,9 +337,36 @@ function getSheepfoldOptions() {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
/* 远程搜耳号 */
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
|
||||
/* 清空所有耳号 */
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
|
||||
/* 删除单个耳号 */
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
getSheepfoldOptions();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.selected-ear-numbers{
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,9 +5,16 @@
|
||||
<el-date-picker v-model="daterangeEventDate" type="daterange" range-separator="-" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
<el-form-item label="耳号" prop="manageTag">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号或电子耳号" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
<el-form-item label="耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="新耳号" prop="newTag">
|
||||
<el-input v-model="queryParams.newTag" placeholder="请输入新耳号" clearable @keyup.enter="handleQuery"
|
||||
@@ -33,7 +40,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
@@ -132,7 +145,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="ChangeEar">
|
||||
import { listChangeEar, getChangeEar, delChangeEar, addChangeEar, updateChangeEar, getSheepByEarNumber, checkTagExists } from "@/api/produce/manage_sheep/changeEar"
|
||||
import { listChangeEar, getChangeEar, delChangeEar, addChangeEar, updateChangeEar, getSheepByEarNumber, checkTagExists,searchEarNumbers } from "@/api/produce/manage_sheep/changeEar"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
@@ -191,7 +204,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
/** 查询修改电子耳号记录列表 */
|
||||
async function getList() {
|
||||
loading.value = true;
|
||||
@@ -258,6 +272,7 @@ function resetQuery() {
|
||||
queryParams.value.newTag = null
|
||||
queryParams.value.oldTag = null
|
||||
queryParams.value.earType = null
|
||||
queryParams.value.manageTagsList = []
|
||||
|
||||
proxy.resetForm("queryRef")
|
||||
|
||||
@@ -408,9 +423,31 @@ function getSheepfoldOptions() {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
getSheepfoldOptions();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.selected-ear-numbers{
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,9 +5,16 @@
|
||||
<el-date-picker v-model="daterangeEventDate" type="daterange" range-separator="-" start-placeholder="开始日期"
|
||||
end-placeholder="结束日期" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="width: 150px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="原品种" prop="varietyOld">
|
||||
<el-select v-model="queryParams.varietyOld" placeholder="请选择原品种" clearable filterable>
|
||||
@@ -29,7 +36,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
@@ -119,9 +132,9 @@
|
||||
</template>
|
||||
|
||||
<script setup name="ChangeVariety">
|
||||
import { listChangeVariety, getChangeVariety, delChangeVariety, addChangeVariety, updateChangeVariety, getSheepByManageTags } from "@/api/produce/manage_sheep/changeVariety"
|
||||
import { listChangeVariety, getChangeVariety, delChangeVariety, addChangeVariety, updateChangeVariety, getSheepByManageTags,searchEarNumbers } from "@/api/produce/manage_sheep/changeVariety"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { listVariety } from '@/api/variety/variety'
|
||||
import { listVariety } from '@/api/fileManagement/variety'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
@@ -174,7 +187,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
/** 查询改品种记录列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -267,6 +281,7 @@ function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
queryParams.value.sheepfoldId = null
|
||||
daterangeEventDate.value = []
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@@ -354,10 +369,31 @@ function getSheepfoldOptions() {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
loadVarietyOptions();
|
||||
getSheepfoldOptions();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
.selected-ear-numbers {
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,9 +5,16 @@
|
||||
<el-date-picker v-model="daterangeTransDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入耳号" clearable @keyup.enter="handleQuery"
|
||||
style="width: 150px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="转出羊舍" prop="foldFrom" style="width: 308px">
|
||||
<el-select v-model="queryParams.foldFrom" placeholder="请选择转出羊舍" style="min-width:150px" clearable>
|
||||
@@ -34,7 +41,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
@@ -149,12 +162,12 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Trans_group">
|
||||
import { listTrans_group, getTrans_group, delTrans_group, addTrans_group, updateTrans_group, approveScTransGroup, listRanch } from '@/api/produce/manage_sheep/trans_group'
|
||||
import { listTrans_group, getTrans_group, delTrans_group, addTrans_group, updateTrans_group, listRanch, searchEarNumbers } from '@/api/produce/manage_sheep/trans_group'
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { checkSheepByManageTags, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
|
||||
import { getSheepTypeList } from "@/api/produce/bodyManage/body_measure"
|
||||
@@ -214,7 +227,8 @@ const data = reactive({
|
||||
},
|
||||
});
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
/** 查询转群记录列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
@@ -492,6 +506,7 @@ function handleQuery() {
|
||||
//重置搜索框
|
||||
function resetQuery() {
|
||||
daterangeTransDate.value = [];
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm('queryRef');
|
||||
handleQuery();
|
||||
}
|
||||
@@ -658,7 +673,20 @@ function loadSheepTypeList() {
|
||||
sheepTypeOptions.value = [];
|
||||
});
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
loadSheepfold();
|
||||
loadRanchList();
|
||||
@@ -676,4 +704,10 @@ onMounted(() => {
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.selected-ear-numbers{
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -6,9 +6,16 @@
|
||||
<el-date-picker v-model="transitionDateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="width: 150px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="品种" prop="varietyId">
|
||||
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" style="min-width:150px" clearable>
|
||||
@@ -42,7 +49,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<!-- 按钮行 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@@ -222,7 +235,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Transition_info">
|
||||
import { listTransition_info, getTransition_info, delTransition_info, addTransition_info, getSheepByRanchId, updateTransition_info, listRanch, approveTransitionInfo } from "@/api/produce/manage_sheep/transition_info"
|
||||
import { listTransition_info, getTransition_info, delTransition_info, addTransition_info, getSheepByRanchId, updateTransition_info, listRanch, approveTransitionInfo,searchEarNumbers } from "@/api/produce/manage_sheep/transition_info"
|
||||
import { checkSheepByManageTags, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
|
||||
import request from '@/utils/request'
|
||||
|
||||
@@ -298,7 +311,8 @@ const data = reactive({
|
||||
}
|
||||
})
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
//获取转场记录列表
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -379,7 +393,7 @@ function loadSheepfoldsByRanch(ranchName) {
|
||||
url: '/sheepfold_management/sheepfold_management/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
ranchId: ranchId,
|
||||
ranchId: ranchId,
|
||||
pageNum: 1,
|
||||
pageSize: 999
|
||||
}
|
||||
@@ -596,6 +610,7 @@ function handleQuery() {
|
||||
function resetQuery() {
|
||||
queryParams.value.transType = null;
|
||||
transitionDateRange.value = [];
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@@ -721,7 +736,20 @@ function handleDelete(row) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
loadRanchOptions();
|
||||
getVarietyOptions();
|
||||
@@ -738,4 +766,11 @@ onMounted(() => {
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.selected-ear-numbers {
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -6,9 +6,16 @@
|
||||
<el-date-picker v-model="daterangeEventDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="width: 150px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepfold">
|
||||
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||
@@ -25,7 +32,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<!-- 按钮区域 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@@ -120,7 +133,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="castrate">
|
||||
import { listCastrate, getCastrate, delCastrate, addCastrate, updateCastrate } from '@/api/produce/other/castrate'
|
||||
import { listCastrate, getCastrate, delCastrate, addCastrate, searchEarNumbers } from '@/api/produce/other/castrate'
|
||||
import { checkSheepByManageTags, getVarietyOptions, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
|
||||
@@ -175,6 +188,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
//通过羊舍获取羊只
|
||||
function loadSheepBySheepfold() {
|
||||
const sheepfoldId = form.value.sheepfold;
|
||||
@@ -311,6 +326,7 @@ function handleQuery() {
|
||||
function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
daterangeEventDate.value = []
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
@@ -443,7 +459,20 @@ function getSheepfoldOptions() {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
getSheepfoldOptions()
|
||||
getVarietyOptions()
|
||||
@@ -459,4 +488,10 @@ onMounted(() => {
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.selected-ear-numbers{
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,9 +5,16 @@
|
||||
<el-date-picker v-model="daterangeEventDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="width: 150px;" />
|
||||
<el-form-item label="管理耳号" prop="manageTagsList">
|
||||
<el-select v-model="queryParams.manageTagsList" multiple filterable remote reserve-keyword
|
||||
placeholder="请输入耳号,支持多选" :remote-method="searchEarNumber" :loading="earLoading" allow-create
|
||||
default-first-option style="width: 260px">
|
||||
<el-option v-for="item in earOptions" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
<el-button type="text" @click="clearEarNumbers"
|
||||
v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" style="margin-left: 8px">
|
||||
清空
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepfold">
|
||||
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||
@@ -24,7 +31,13 @@
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div v-if="queryParams.manageTagsList && queryParams.manageTagsList.length > 0" class="selected-ear-numbers">
|
||||
<span style="margin-right: 10px; color: #606266;">已选耳号:</span>
|
||||
<el-tag v-for="tag in queryParams.manageTagsList" :key="tag" closable @close="removeEarNumber(tag)"
|
||||
style="margin-right: 8px;">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<!-- 按钮 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@@ -120,7 +133,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="FixHoof">
|
||||
import { listFixHoof, getFixHoof, delFixHoof, addFixHoof, updateFixHoof, checkSheepByManageTags, getVarietyOptions, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
|
||||
import { listFixHoof, getFixHoof, delFixHoof, addFixHoof, updateFixHoof, checkSheepByManageTags, getVarietyOptions, getSheepBySheepfoldId,searchEarNumbers } from '@/api/produce/other/fixHoof'
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@@ -172,7 +185,8 @@ const data = reactive({
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const earOptions = ref([])
|
||||
const earLoading = ref(false)
|
||||
//根据羊舍获取羊只
|
||||
function loadSheepBySheepfold() {
|
||||
const currentSheepfoldId = form.value.sheepfold;
|
||||
@@ -300,6 +314,7 @@ function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
daterangeEventDate.value = []
|
||||
queryParams.value.varietyId = null
|
||||
queryParams.value.manageTagsList = []
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
@@ -389,7 +404,20 @@ function getSheepfoldOptions() {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
function searchEarNumber(query) {
|
||||
if (!query) { earOptions.value = []; return }
|
||||
earLoading.value = true
|
||||
searchEarNumbers(query.trim()).then(res => {
|
||||
earOptions.value = res.data || []
|
||||
}).finally(() => earLoading.value = false)
|
||||
}
|
||||
function clearEarNumbers() {
|
||||
queryParams.value.manageTagsList = []
|
||||
}
|
||||
function removeEarNumber(tag) {
|
||||
const idx = queryParams.value.manageTagsList.indexOf(tag)
|
||||
if (idx > -1) queryParams.value.manageTagsList.splice(idx, 1)
|
||||
}
|
||||
onMounted(() => {
|
||||
getSheepfoldOptions()
|
||||
getVarietyOptions()
|
||||
@@ -405,4 +433,11 @@ onMounted(() => {
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.selected-ear-numbers {
|
||||
margin-bottom: 16px;
|
||||
padding: 10px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -43,7 +43,7 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="outList" @selection-change="handleSelectionChange"
|
||||
<el-table v-loading="loading" height="1000px" :data="outList" @selection-change="handleSelectionChange"
|
||||
@sort-change="handleSortChange" ref="tableRef">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="stockOutCode" />
|
||||
|
||||
Reference in New Issue
Block a user