Merge branch 'main' of http://e19510c831.iok.la/admin/zhyc-sheep-ui
This commit is contained in:
commit
b881e2e325
@ -36,17 +36,17 @@ export function updateTrans_group(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除转群记录
|
// 删除转群记录
|
||||||
export function delTrans_group(id) {
|
export function delTrans_group(ids) {
|
||||||
|
const idStr = Array.isArray(ids) ? ids.join(',') : String(ids)
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/manage_sheep/trans_group/' + id,
|
url: `/produce/manage_sheep/trans_group/${idStr}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取羊舍列表
|
// 获取羊舍列表
|
||||||
export function listSheepfold() {
|
export function listSheepfold() {
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/sheepfold/list',
|
url: '/sheepfold_management/sheepfold_management/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,9 @@ export function updateFixHoof(data) {
|
|||||||
}
|
}
|
||||||
// 删除修蹄
|
// 删除修蹄
|
||||||
export function delFixHoof(ids) {
|
export function delFixHoof(ids) {
|
||||||
|
const idStr = Array.isArray(ids) ? ids.join(',') : String(ids)
|
||||||
return request({
|
return request({
|
||||||
url: `/produce/other/fixHoof/${ids.join(',')}`,
|
url: `/produce/other/fixHoof/${idStr}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<!-- 顶部按钮 -->
|
||||||
<el-button type="warning" icon="Upload" @click="handleExportForm">导出</el-button>
|
<el-button type="warning" icon="Upload" @click="handleExportForm">导出</el-button>
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleImport"
|
<el-button type="primary" plain icon="Plus" @click="handleImport"
|
||||||
v-hasPermi="['produce:add_sheep:import']">导入</el-button>
|
v-hasPermi="['produce:add_sheep:import']">导入</el-button>
|
||||||
|
|
||||||
|
<!-- 新增/编辑表单 -->
|
||||||
<el-form :model="form" ref="formRef" label-position="left" label-width="100px" style="margin-top:15px">
|
<el-form :model="form" ref="formRef" label-position="left" label-width="100px" style="margin-top:15px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="耳号" prop="earNumber">
|
<el-form-item label="耳号" prop="earNumber">
|
||||||
<el-input v-model="form.earNumber" placeholder="请输入羊只id" />
|
<el-input v-model="form.earNumber" placeholder="请输入耳号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
@ -18,6 +21,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="父号" prop="father">
|
<el-form-item label="父号" prop="father">
|
||||||
@ -30,9 +34,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="出生体重" prop="bornWeight">
|
<el-form-item label="出生体重(kg)" prop="bornWeight">
|
||||||
<el-input v-model="form.bornWeight" placeholder="请输入出生体重" />
|
<el-input v-model="form.bornWeight" placeholder="请输入出生体重" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -42,14 +47,15 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="性别" prop="gender">
|
<el-form-item label="性别" prop="gender">
|
||||||
<el-select v-model="form.gender" placeholder="请选择性别">
|
<el-select v-model="form.gender" placeholder="请选择性别">
|
||||||
<el-option label="公" value="1" />
|
<el-option label="公" :value="1" />
|
||||||
<el-option label="母" value="0" />
|
<el-option label="母" :value="0" />
|
||||||
<el-option label="阉羊" value="2" />
|
<el-option label="阉羊" :value="2" />
|
||||||
<el-option label="兼性" value="3" />
|
<el-option label="兼性" :value="3" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -59,10 +65,18 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="品种" prop="varietyId">
|
<el-form-item label="品种" prop="varietyId">
|
||||||
<el-input v-model="form.varietyId" placeholder="请输入品种" />
|
<el-select v-model="form.varietyId" placeholder="请选择品种" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in varietyOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.variety"
|
||||||
|
:value="Number(item.id)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
@ -71,6 +85,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-form-item label="技术员" prop="technician">
|
<el-form-item label="技术员" prop="technician">
|
||||||
@ -78,6 +93,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-form-item label="备注" prop="comment">
|
<el-form-item label="备注" prop="comment">
|
||||||
@ -93,10 +109,20 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
<el-dialog title="导入羊只信息" v-model="importOpen" width="400px" append-to-body>
|
<el-dialog title="导入羊只信息" v-model="importOpen" width="400px" append-to-body>
|
||||||
<el-upload ref="uploadRef" :limit="1" accept=".xlsx,.xls" :action="importUrl" :headers="headers"
|
<el-upload
|
||||||
:auto-upload="false" :on-success="handleImportSuccess" :on-error="handleImportError" drag>
|
ref="uploadRef"
|
||||||
<i class="el-icon-upload"></i>
|
:limit="1"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
:action="importUrl"
|
||||||
|
:headers="headers"
|
||||||
|
:auto-upload="false"
|
||||||
|
:on-success="handleImportSuccess"
|
||||||
|
:on-error="handleImportError"
|
||||||
|
drag
|
||||||
|
>
|
||||||
|
<i class="el-icon-upload" />
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -107,10 +133,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue'
|
||||||
import { addSheep } from '@/api/produce/manage_sheep/add_sheep/add_sheep';
|
import request from '@/utils/request'
|
||||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management';
|
import { addSheep, exportSheepForm } from '@/api/produce/manage_sheep/add_sheep/add_sheep'
|
||||||
|
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
import { getCurrentInstance } from 'vue'
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
/* -------------------- 表单 -------------------- */
|
||||||
const form = ref({
|
const form = ref({
|
||||||
earNumber: '',
|
earNumber: '',
|
||||||
sheepfold: '',
|
sheepfold: '',
|
||||||
@ -123,50 +154,57 @@ const form = ref({
|
|||||||
varietyId: '',
|
varietyId: '',
|
||||||
joinDate: '',
|
joinDate: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
technician: '',
|
technician: ''
|
||||||
});
|
})
|
||||||
|
const formRef = ref(null)
|
||||||
const formRef = ref(null);
|
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
earNumber: [{ required: true, message: '请输入耳号', trigger: 'blur' }],
|
earNumber: [{ required: true, message: '请输入耳号', trigger: 'blur' }],
|
||||||
sheepfold: [{ required: true, message: '请输入羊舍', trigger: 'change' }],
|
sheepfold: [{ required: true, message: '请选择羊舍', trigger: 'change' }],
|
||||||
father: [{ message: '请输入父号', trigger: 'blur' }],
|
|
||||||
mother: [{ message: '请输入母号', trigger: 'blur' }],
|
|
||||||
bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'blur' }],
|
bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'blur' }],
|
||||||
birthday: [{ required: true, message: '请选择出生日期', trigger: 'change' }],
|
birthday: [{ required: true, message: '请选择出生日期', trigger: 'change' }],
|
||||||
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
|
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
|
||||||
parity: [{ message: '请输入胎次', trigger: 'blur' }],
|
varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }]
|
||||||
varietyId: [{ required: true, message: '请输入品种', trigger: 'blur' }],
|
|
||||||
joinDate: [{ message: '请选择入群日期', trigger: 'change' }],
|
|
||||||
technician: [{ message: '请输入技术员', trigger: 'blur' }],
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//表单验证 提交表单数据
|
|
||||||
const submitForm = () => {
|
|
||||||
formRef.value.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
addSheep(form.value) // 调用 API 方法,addSheep 应已在 @/api/sheep/sheep.js 中定义
|
|
||||||
.then(response => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
alert('新增成功');
|
|
||||||
resetForm();
|
|
||||||
// 可以在这里添加刷新列表的逻辑,例如调用 list 方法
|
|
||||||
} else {
|
|
||||||
alert(response.msg || '新增失败');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------- 下拉数据 -------------------- */
|
||||||
|
const sheepfoldOptions = ref([])
|
||||||
|
const varietyOptions = ref([])
|
||||||
|
|
||||||
|
function getSheepfoldOptions() {
|
||||||
|
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||||
|
sheepfoldOptions.value = res.rows || []
|
||||||
})
|
})
|
||||||
.catch(error => {
|
|
||||||
console.error('新增失败:', error);
|
|
||||||
alert('新增失败,请稍后重试');
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert('请填写所有必填字段');
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
};
|
function getVarietyOptions() {
|
||||||
const resetForm = () => {
|
request({
|
||||||
|
url: '/base/variety/list',
|
||||||
|
method: 'get',
|
||||||
|
params: { pageNum: 1, pageSize: 9999 }
|
||||||
|
}).then(res => {
|
||||||
|
varietyOptions.value = res.rows || []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------- 功能方法 -------------------- */
|
||||||
|
function submitForm() {
|
||||||
|
formRef.value.validate(valid => {
|
||||||
|
if (!valid) return
|
||||||
|
addSheep(form.value).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal.msgSuccess('新增成功')
|
||||||
|
resetForm()
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError(res.msg || '新增失败') // 这里显示“耳号已存在”等后端报错
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
proxy.$modal.msgError('请求异常,请稍后重试')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetForm() {
|
||||||
form.value = {
|
form.value = {
|
||||||
earNumber: '',
|
earNumber: '',
|
||||||
sheepfold: '',
|
sheepfold: '',
|
||||||
@ -179,63 +217,66 @@ const resetForm = () => {
|
|||||||
varietyId: '',
|
varietyId: '',
|
||||||
joinDate: '',
|
joinDate: '',
|
||||||
comment: '',
|
comment: '',
|
||||||
technician: '',
|
technician: ''
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
//导出
|
|
||||||
import { exportSheepForm } from '@/api/produce/manage_sheep/add_sheep/add_sheep';
|
|
||||||
|
|
||||||
function handleExportForm() {
|
function handleExportForm() {
|
||||||
// 把当前表单数据直接传后端
|
|
||||||
exportSheepForm(form.value).then(res => {
|
exportSheepForm(form.value).then(res => {
|
||||||
// 使用 Ruoyi 自带的下载方法
|
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
const link = document.createElement('a')
|
||||||
const fileName = `羊只信息_${new Date().getTime()}.xlsx`;
|
link.href = URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a');
|
link.download = `羊只信息_${Date.now()}.xlsx`
|
||||||
link.href = URL.createObjectURL(blob);
|
link.click()
|
||||||
link.download = fileName;
|
})
|
||||||
link.click();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------- 导入 -------------------- */
|
||||||
|
const uploadRef = ref(null)
|
||||||
|
const importOpen = ref(false)
|
||||||
|
const importUrl = ref(import.meta.env.VITE_APP_BASE_API + '/produce/manage_sheep/add_sheep/importData')
|
||||||
|
const headers = ref({ Authorization: 'Bearer ' + getToken() })
|
||||||
|
|
||||||
//导入
|
function handleImport() {
|
||||||
import { getToken } from '@/utils/auth';
|
importOpen.value = true
|
||||||
|
}
|
||||||
const uploadRef = ref();
|
|
||||||
const importOpen = ref(false);
|
|
||||||
const importUrl = ref(import.meta.env.VITE_APP_BASE_API + '/produce/manage_sheep/add_sheep/importData');
|
|
||||||
const headers = ref({ Authorization: 'Bearer ' + getToken() });
|
|
||||||
|
|
||||||
function handleImport() { importOpen.value = true; }
|
|
||||||
function downloadTemplate() {
|
function downloadTemplate() {
|
||||||
proxy.download('/produce/manage_sheep/add_sheep/importTemplate', {}, `羊只模板_${Date.now()}.xlsx`);
|
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(); }
|
function submitUpload() {
|
||||||
|
uploadRef.value?.submit()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上传成功回调
|
||||||
function handleImportSuccess(res) {
|
function handleImportSuccess(res) {
|
||||||
proxy.$modal.msgSuccess(res.msg || '导入成功');
|
if (res.code === 200) {
|
||||||
importOpen.value = false;
|
proxy.$modal.msgSuccess(res.msg || '导入成功')
|
||||||
uploadRef.value?.clearFiles();
|
importOpen.value = false
|
||||||
|
uploadRef.value?.clearFiles()
|
||||||
|
} else {
|
||||||
|
// 业务失败
|
||||||
|
proxy.$modal.msgError('导入失败:' + (res.msg || '未知原因'))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上传失败(网络/服务器异常)
|
||||||
function handleImportError(err) {
|
function handleImportError(err) {
|
||||||
proxy.$modal.msgError(JSON.parse(err.message)?.msg || '导入失败');
|
const msg = JSON.parse(err.message || '{}')?.msg || '网络异常'
|
||||||
|
proxy.$modal.msgError('导入失败:' + msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**获取羊舍数据 */
|
/* -------------------- 初始化 -------------------- */
|
||||||
const sheepfoldOptions = ref([]);
|
|
||||||
function getSheepfoldOptions() {
|
|
||||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
|
||||||
sheepfoldOptions.value = res.rows;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getSheepfoldOptions();
|
getSheepfoldOptions()
|
||||||
});
|
getVarietyOptions()
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="品种" prop="varietyId">
|
||||||
|
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" style="min-width:150px" clearable>
|
||||||
|
<el-option v-for="item in varietyOptions" :key="item.id" :label="item.variety" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" style="width: 150px;" placeholder="请选择状态" clearable>
|
<el-select v-model="queryParams.status" style="width: 150px;" placeholder="请选择状态" clearable>
|
||||||
<el-option v-for="dict in status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-option v-for="dict in status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
@ -55,17 +60,10 @@
|
|||||||
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
<el-table-column label="转出羊舍" align="center" prop="foldFromName" />
|
<el-table-column label="转出羊舍" align="center" prop="foldFromName" />
|
||||||
<el-table-column label="转入羊舍" align="center" prop="foldToName" />
|
<el-table-column label="转入羊舍" align="center" prop="foldToName" />
|
||||||
<el-table-column label="转群原因" align="center" prop="reason" min-width="160">
|
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||||
<template #default="scope">
|
<el-table-column label="转群原因" align="center" prop="reasonText" />
|
||||||
<dict-tag :options="trans_group_reason" :value="scope.row.reason" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="技术员" align="center" prop="technician" />
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="statusText" />
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :options="status" :value="scope.row.status" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
@ -106,9 +104,15 @@
|
|||||||
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="品种" prop="varietyId">
|
||||||
|
<el-select v-model="form.varietyId" placeholder="请选择品种" clearable>
|
||||||
|
<el-option v-for="item in varietyOptions" :key="item.id" :label="item.variety" :value="Number(item.id)" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="转群原因" prop="reason">
|
<el-form-item label="转群原因" prop="reason">
|
||||||
<el-select v-model="form.reason" placeholder="请选择转群原因" clearable>
|
<el-select v-model="form.reason" placeholder="请选择转群原因" clearable>
|
||||||
<el-option v-for="dict in trans_group_reason" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-option v-for="dict in trans_group_reason" :key="dict.value" :label="dict.label"
|
||||||
|
:value="Number(dict.value)" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="技术员" prop="technician">
|
<el-form-item label="技术员" prop="technician">
|
||||||
@ -139,11 +143,14 @@
|
|||||||
<el-form-item label="转入羊舍">
|
<el-form-item label="转入羊舍">
|
||||||
<el-input :value="sheepfoldNameMap[approveForm.foldTo] || approveForm.foldTo" disabled />
|
<el-input :value="sheepfoldNameMap[approveForm.foldTo] || approveForm.foldTo" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="品种">
|
||||||
|
<el-input :value="approveForm.varietyName" disabled />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="转群原因">
|
<el-form-item label="转群原因">
|
||||||
<el-select v-model="approveForm.reason" disabled>
|
<el-input :value="approveForm.reasonText" disabled />
|
||||||
<el-option :label="trans_group_reason.find(d => d.value == approveForm.reason)?.label || ''"
|
</el-form-item>
|
||||||
:value="approveForm.reason" />
|
<el-form-item label="状态">
|
||||||
</el-select>
|
<el-input :value="approveForm.statusText" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="技术员">
|
<el-form-item label="技术员">
|
||||||
<el-input v-model="approveForm.technician" disabled />
|
<el-input v-model="approveForm.technician" disabled />
|
||||||
@ -162,13 +169,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Trans_group">
|
<script setup name="Trans_group">
|
||||||
import { listTrans_group, getTrans_group, delTrans_group, addTrans_group, updateTrans_group } from "@/api/produce/manage_sheep/trans_group/trans_group"
|
import {
|
||||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management';
|
listTrans_group,
|
||||||
|
getTrans_group,
|
||||||
|
delTrans_group,
|
||||||
|
addTrans_group,
|
||||||
|
updateTrans_group
|
||||||
|
} from '@/api/produce/manage_sheep/trans_group/trans_group'
|
||||||
|
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const { trans_group_reason, status } = proxy.useDict('trans_group_reason', 'status')
|
const { trans_group_reason, status } = proxy.useDict('trans_group_reason', 'status')
|
||||||
|
|
||||||
|
/* -------------------- 响应式变量 -------------------- */
|
||||||
const trans_groupList = ref([])
|
const trans_groupList = ref([])
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
@ -177,9 +191,17 @@ const ids = ref([])
|
|||||||
const single = ref(true)
|
const single = ref(true)
|
||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const title = ref("")
|
const title = ref('')
|
||||||
const daterangeCreateTime = ref([])
|
const daterangeCreateTime = ref([])
|
||||||
|
|
||||||
|
const approveDialog = ref(false)
|
||||||
|
const approveForm = ref({})
|
||||||
|
|
||||||
|
const sheepfoldOptions = ref([])
|
||||||
|
const sheepfoldNameMap = ref({})
|
||||||
|
const varietyOptions = ref([])
|
||||||
|
|
||||||
|
/* -------------------- 表单 & 查询 -------------------- */
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@ -188,61 +210,43 @@ const data = reactive({
|
|||||||
sheepId: null,
|
sheepId: null,
|
||||||
foldTo: null,
|
foldTo: null,
|
||||||
foldFrom: null,
|
foldFrom: null,
|
||||||
|
varietyId: null, // 新增
|
||||||
status: null,
|
status: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
id: [
|
sheepId: [{ required: true, message: '羊只id不能为空', trigger: 'blur' }],
|
||||||
{ required: true, message: "$comment不能为空", trigger: "blur" }
|
foldFrom: [{ required: true, message: '转出羊舍不能为空', trigger: 'change' }],
|
||||||
],
|
foldTo: [{ required: true, message: '转入羊舍不能为空', trigger: 'change' }],
|
||||||
sheepId: [
|
varietyId: [{ required: true, message: '品种不能为空', trigger: 'change' }],
|
||||||
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
reason: [{ required: true, message: '转群原因不能为空', trigger: 'change' }],
|
||||||
],
|
technician: [{ required: true, message: '技术员不能为空', trigger: 'blur' }]
|
||||||
foldTo: [
|
|
||||||
{ required: true, message: "转入羊舍不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
foldFrom: [
|
|
||||||
{ required: true, message: "转出羊舍不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
reason: [
|
|
||||||
{ required: true, message: "转群原因不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
technician: [
|
|
||||||
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
/** 查询转群记录列表 */
|
/* -------------------- 业务函数 -------------------- */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
queryParams.value.params = {}
|
queryParams.value.params = {}
|
||||||
if (null != daterangeCreateTime && '' != daterangeCreateTime) {
|
if (daterangeCreateTime.value?.length) {
|
||||||
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
queryParams.value.params.beginCreateTime = daterangeCreateTime.value[0]
|
||||||
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
queryParams.value.params.endCreateTime = daterangeCreateTime.value[1]
|
||||||
}
|
}
|
||||||
listTrans_group(queryParams.value).then(response => {
|
listTrans_group(queryParams.value).then(res => {
|
||||||
trans_groupList.value = response.rows
|
trans_groupList.value = res.rows
|
||||||
total.value = response.total
|
total.value = res.total
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
|
||||||
function cancel() {
|
|
||||||
open.value = false
|
|
||||||
reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 表单重置
|
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
id: null,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
foldTo: null,
|
|
||||||
foldFrom: null,
|
foldFrom: null,
|
||||||
|
foldTo: null,
|
||||||
|
varietyId: null, // 新增
|
||||||
reason: null,
|
reason: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
status: null,
|
status: null,
|
||||||
@ -250,160 +254,130 @@ function reset() {
|
|||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
}
|
}
|
||||||
proxy.resetForm("trans_groupRef")
|
proxy.resetForm('trans_groupRef')
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNum = 1
|
queryParams.value.pageNum = 1
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
daterangeCreateTime.value = []
|
daterangeCreateTime.value = []
|
||||||
proxy.resetForm("queryRef")
|
proxy.resetForm('queryRef')
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多选框选中数据
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.id)
|
ids.value = selection.map(item => item.id)
|
||||||
single.value = selection.length != 1
|
single.value = selection.length !== 1
|
||||||
multiple.value = !selection.length
|
multiple.value = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
reset()
|
reset()
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "添加转群记录"
|
title.value = '添加转群记录'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset()
|
reset()
|
||||||
const _id = row.id || ids.value
|
const _id = row.id || ids.value
|
||||||
getTrans_group(_id).then(response => {
|
getTrans_group(_id).then(res => {
|
||||||
const data = response.data
|
const d = res.data
|
||||||
data.foldFrom = Number(data.foldFrom)
|
// 统一转成 Number,避免 undefined
|
||||||
data.foldTo = Number(data.foldTo)
|
d.foldFrom = Number(d.foldFrom ?? 0)
|
||||||
data.reason = String(data.reason)
|
d.foldTo = Number(d.foldTo ?? 0)
|
||||||
form.value = data
|
d.reason = Number(d.reason ?? 0)
|
||||||
|
d.status = Number(d.status ?? 0)
|
||||||
|
d.varietyId = Number(d.varietyId ?? 0)
|
||||||
|
form.value = d
|
||||||
open.value = true
|
open.value = true
|
||||||
|
title.value = '修改转群记录'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["trans_groupRef"].validate(valid => {
|
proxy.$refs.trans_groupRef.validate(valid => {
|
||||||
if (valid) {
|
if (!valid) return
|
||||||
if (form.value.id != null) {
|
const api = form.value.id ? updateTrans_group : addTrans_group
|
||||||
updateTrans_group(form.value).then(response => {
|
api(form.value).then(() => {
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess(form.value.id ? '修改成功' : '新增成功')
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
addTrans_group(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除转群记录编号为"' + _ids + '"的数据项?').then(function () {
|
proxy.$modal.confirm(`是否确认删除转群记录编号为“${_ids}”的数据项?`)
|
||||||
return delTrans_group(_ids)
|
.then(() => delTrans_group(_ids))
|
||||||
}).then(() => {
|
.then(() => {
|
||||||
getList()
|
getList()
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
}).catch(() => { })
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('/produce/manage_sheep/trans_group/export', {
|
proxy.download(
|
||||||
...queryParams.value
|
'/produce/manage_sheep/trans_group/export',
|
||||||
}, `trans_group_${new Date().getTime()}.xlsx`);
|
{ ...queryParams.value },
|
||||||
|
`trans_group_${Date.now()}.xlsx`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------- 审批 -------------------- */
|
||||||
// 审批记录的对话框
|
|
||||||
const approveDialog = ref(false);
|
|
||||||
const approveForm = ref({});
|
|
||||||
|
|
||||||
// 审批按钮操作
|
|
||||||
function handleApprove(row) {
|
function handleApprove(row) {
|
||||||
approveForm.value = { ...row };
|
approveForm.value = { ...row }
|
||||||
approveDialog.value = true;
|
approveDialog.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同意审批
|
|
||||||
function handleApproveAgree() {
|
function handleApproveAgree() {
|
||||||
approveForm.value.status = 1; // 状态设置为同意
|
approveForm.value.status = 1
|
||||||
updateTrans_group(approveForm.value).then(() => {
|
updateTrans_group(approveForm.value).then(() => {
|
||||||
approveDialog.value = false;
|
approveDialog.value = false
|
||||||
proxy.$modal.msgSuccess("审批成功,状态已更新为同意");
|
proxy.$modal.msgSuccess('审批成功,状态已更新为同意')
|
||||||
getList();
|
getList()
|
||||||
}).catch((error) => {
|
})
|
||||||
proxy.$modal.msgError(`审批失败:${error}`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 驳回审批
|
|
||||||
function handleApproveReject() {
|
function handleApproveReject() {
|
||||||
approveForm.value.status = 2; // 状态设置为驳回
|
approveForm.value.status = 2
|
||||||
updateTrans_group(approveForm.value).then(() => {
|
updateTrans_group(approveForm.value).then(() => {
|
||||||
approveDialog.value = false;
|
approveDialog.value = false
|
||||||
proxy.$modal.msgSuccess("审批成功,状态已更新为驳回");
|
proxy.$modal.msgSuccess('审批成功,状态已更新为驳回')
|
||||||
getList();
|
getList()
|
||||||
}).catch((error) => {
|
})
|
||||||
proxy.$modal.msgError(`审批失败:${error}`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载所有羊舍
|
/* -------------------- 下拉数据 -------------------- */
|
||||||
const sheepfoldOptions = ref([]);
|
function loadSheepfold() {
|
||||||
|
|
||||||
function getSheepfoldOptions() {
|
|
||||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
|
||||||
sheepfoldOptions.value = res.rows; // [{id, sheepfoldName}, ...]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
getSheepfoldOptions();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
const sheepfoldNameMap = ref({})
|
|
||||||
|
|
||||||
function loadSheepfoldMap() {
|
|
||||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||||
|
sheepfoldOptions.value = res.rows
|
||||||
sheepfoldNameMap.value = res.rows.reduce((acc, item) => {
|
sheepfoldNameMap.value = res.rows.reduce((acc, item) => {
|
||||||
acc[item.id] = item.sheepfoldName
|
acc[item.id] = item.sheepfoldName
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function getVarietyOptions() {
|
||||||
onMounted(() => {
|
request({
|
||||||
nextTick(() => {
|
url: '/base/variety/list',
|
||||||
if (trans_group_reason.value && trans_group_reason.value.length) {
|
method: 'get',
|
||||||
trans_group_reason.value.forEach(item => {
|
params: { pageNum: 1, pageSize: 9999 }
|
||||||
item.value = Number(item.value)
|
}).then(res => {
|
||||||
|
varietyOptions.value = res.rows || []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
loadSheepfoldMap()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------- 初始化 -------------------- */
|
||||||
|
onMounted(() => {
|
||||||
|
loadSheepfold()
|
||||||
|
getVarietyOptions()
|
||||||
getList()
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
@ -1,24 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<!-- 搜索区域 -->
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="羊只id" prop="sheepId">
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
<el-input v-model="queryParams.sheepId" placeholder="请输入羊只id" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.sheepId" placeholder="请输入羊只id" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="羊舍" prop="sheepfold">
|
<el-form-item label="羊舍" prop="sheepfold">
|
||||||
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||||
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="品种" prop="varietyId">
|
||||||
|
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" style="min-width:150px" clearable>
|
||||||
|
<el-option v-for="item in varietyOptions" :key="item.id" :label="item.variety" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="创建时间" style="width: 308px">
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
<el-date-picker v-model="daterangeCreateTime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
<el-date-picker v-model="daterangeCreateTime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 按钮区域 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
@ -36,14 +47,15 @@
|
|||||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
v-hasPermi="['produce:castrate:export']">导出</el-button>
|
v-hasPermi="['produce:castrate:export']">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表表格 -->
|
||||||
<el-table v-loading="loading" :data="castrateList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="castrateList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
|
||||||
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
<el-table-column label="羊舍名称" align="center" prop="sheepfoldName" />
|
<el-table-column label="羊舍名称" align="center" prop="sheepfoldName" />
|
||||||
|
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
<el-table-column label="技术员" align="center" prop="technician" />
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
@ -64,7 +76,7 @@
|
|||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
<!-- 添加或修改去势对话框 -->
|
<!-- 新增/修改弹窗 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
<el-form ref="castrateRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="castrateRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="羊只id" prop="sheepId">
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
@ -75,6 +87,11 @@
|
|||||||
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="品种" prop="varietyId">
|
||||||
|
<el-select v-model="form.varietyId" placeholder="请选择品种" clearable>
|
||||||
|
<el-option v-for="item in varietyOptions" :key="item.id" :label="item.variety" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="技术员" prop="technician">
|
<el-form-item label="技术员" prop="technician">
|
||||||
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -93,8 +110,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="castrate">
|
<script setup name="castrate">
|
||||||
import { listCastrate, getCastrate, delCastrate, addCastrate, updateCastrate } from "@/api/produce/other/castrate/castrate"
|
import { listCastrate, getCastrate, delCastrate, addCastrate, updateCastrate } from '@/api/produce/other/castrate/castrate'
|
||||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management';
|
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
@ -106,7 +124,7 @@ const ids = ref([])
|
|||||||
const single = ref(true)
|
const single = ref(true)
|
||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const title = ref("")
|
const title = ref('')
|
||||||
const daterangeCreateTime = ref([])
|
const daterangeCreateTime = ref([])
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@ -116,149 +134,151 @@ const data = reactive({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
sheepfold: null,
|
sheepfold: null,
|
||||||
|
varietyId: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
id: [
|
|
||||||
{ required: true, message: "$comment不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
sheepId: [
|
sheepId: [
|
||||||
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
{ required: true, message: '羊只id不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
sheepfold: [
|
sheepfold: [
|
||||||
{ required: true, message: "羊舍不能为空", trigger: "change" }
|
{ required: true, message: '羊舍不能为空', trigger: 'change' }
|
||||||
|
],
|
||||||
|
varietyId: [
|
||||||
|
{ required: true, message: '品种不能为空', trigger: 'change' }
|
||||||
],
|
],
|
||||||
technician: [
|
technician: [
|
||||||
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
{ required: true, message: '技术员不能为空', trigger: 'blur' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
/** 查询去势列表 */
|
/** 查询列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
queryParams.value.params = {}
|
queryParams.value.params = {}
|
||||||
if (null != daterangeCreateTime && '' != daterangeCreateTime) {
|
if (daterangeCreateTime.value && daterangeCreateTime.value.length === 2) {
|
||||||
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
queryParams.value.params.beginCreateTime = daterangeCreateTime.value[0]
|
||||||
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
queryParams.value.params.endCreateTime = daterangeCreateTime.value[1]
|
||||||
}
|
}
|
||||||
listCastrate(queryParams.value).then(response => {
|
listCastrate(queryParams.value).then(res => {
|
||||||
castrateList.value = response.rows
|
castrateList.value = res.rows
|
||||||
total.value = response.total
|
total.value = res.total
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
id: null,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
sheepfold: null,
|
sheepfold: null,
|
||||||
|
varietyId: null,
|
||||||
comment: null,
|
comment: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
}
|
}
|
||||||
proxy.resetForm("castrateRef")
|
proxy.resetForm('castrateRef')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNum = 1
|
queryParams.value.pageNum = 1
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
daterangeCreateTime.value = []
|
daterangeCreateTime.value = []
|
||||||
proxy.resetForm("queryRef")
|
proxy.resetForm('queryRef')
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多选框选中数据
|
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.id)
|
ids.value = selection.map(item => item.id)
|
||||||
single.value = selection.length != 1
|
single.value = selection.length !== 1
|
||||||
multiple.value = !selection.length
|
multiple.value = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
reset()
|
reset()
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "添加去势"
|
title.value = '添加去势'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset()
|
reset()
|
||||||
const _id = row.id || ids.value
|
const _id = row.id || ids.value
|
||||||
getCastrate(_id).then(response => {
|
getCastrate(_id).then(res => {
|
||||||
form.value = response.data
|
form.value = res.data
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "修改去势"
|
title.value = '修改去势'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["castrateRef"].validate(valid => {
|
proxy.$refs.castrateRef.validate(valid => {
|
||||||
if (valid) {
|
if (!valid) return
|
||||||
if (form.value.id != null) {
|
if (form.value.id) {
|
||||||
updateCastrate(form.value).then(response => {
|
updateCastrate(form.value).then(() => {
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess('修改成功')
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addCastrate(form.value).then(response => {
|
addCastrate(form.value).then(() => {
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
proxy.$modal.msgSuccess('新增成功')
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除去势编号为"' + _ids + '"的数据项?').then(function () {
|
proxy.$modal.confirm(`是否确认删除去势编号为"${_ids}"的数据项?`).then(() => {
|
||||||
return delCastrate(_ids)
|
return delCastrate(_ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList()
|
getList()
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
}).catch(() => { })
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('/produce/other/castrate/export', {
|
proxy.download('/produce/other/castrate/export', { ...queryParams.value }, `castrate_${new Date().getTime()}.xlsx`)
|
||||||
...queryParams.value
|
|
||||||
}, `castrate_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 加载所有羊舍 */
|
const sheepfoldOptions = ref([])
|
||||||
const sheepfoldOptions = ref([]);
|
|
||||||
function getSheepfoldOptions() {
|
function getSheepfoldOptions() {
|
||||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||||
sheepfoldOptions.value = res.rows; // [{id, sheepfoldName}, ...]
|
sheepfoldOptions.value = res.rows
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const varietyOptions = ref([])
|
||||||
|
function getVarietyOptions() {
|
||||||
|
request({
|
||||||
|
url: '/base/variety/list',
|
||||||
|
method: 'get',
|
||||||
|
params: { pageNum: 1, pageSize: 9999 }
|
||||||
|
}).then(res => {
|
||||||
|
varietyOptions.value = res.rows || []
|
||||||
|
console.log(varietyOptions.value);
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
|
||||||
getSheepfoldOptions();
|
|
||||||
});
|
|
||||||
getList()
|
getList()
|
||||||
|
getSheepfoldOptions()
|
||||||
|
getVarietyOptions()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
@ -1,23 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
<!-- 搜索 -->
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="羊只id" prop="sheepId">
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
<el-input v-model="queryParams.sheepId" placeholder="请输入羊只id" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.sheepId" placeholder="请输入羊只id" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="羊舍" prop="sheepfold">
|
<el-form-item label="羊舍" prop="sheepfold">
|
||||||
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width: 150px;" clearable>
|
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||||
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" style="width: 308px">
|
|
||||||
<el-date-picker v-model="daterangeCreateTime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
<el-form-item label="品种" prop="varietyId">
|
||||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" style="min-width:150px" clearable>
|
||||||
|
<el-option v-for="item in varietyOptions" :key="item.id" :label="item.variety" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
|
<el-date-picker v-model="daterangeCreateTime"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 按钮 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
@ -35,14 +51,15 @@
|
|||||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
v-hasPermi="['fixHoof:fixHoof:export']">导出</el-button>
|
v-hasPermi="['fixHoof:fixHoof:export']">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
<el-table v-loading="loading" :data="fixHoofList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="fixHoofList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
|
||||||
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
<el-table-column label="羊舍名称" align="center" prop="sheepfoldName" />
|
<el-table-column label="羊舍名称" align="center" prop="sheepfoldName" />
|
||||||
|
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
<el-table-column label="技术员" align="center" prop="technician" />
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
@ -61,10 +78,13 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
<pagination v-show="total > 0"
|
||||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
: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-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
<el-form ref="fixHoofRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="fixHoofRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="羊只id" prop="sheepId">
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
@ -75,6 +95,11 @@
|
|||||||
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="品种" prop="varietyId">
|
||||||
|
<el-select v-model="form.varietyId" placeholder="请选择品种" clearable>
|
||||||
|
<el-option v-for="item in varietyOptions" :key="item.id" :label="item.variety" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="comment">
|
<el-form-item label="备注" prop="comment">
|
||||||
<el-input v-model="form.comment" placeholder="请输入备注" />
|
<el-input v-model="form.comment" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -93,8 +118,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="FixHoof">
|
<script setup name="FixHoof">
|
||||||
import { listFixHoof, getFixHoof, delFixHoof, addFixHoof, updateFixHoof } from "@/api/produce/other/fixHoof/fixHoof"
|
import { listFixHoof, getFixHoof, delFixHoof, addFixHoof, updateFixHoof } from '@/api/produce/other/fixHoof/fixHoof'
|
||||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management';
|
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
@ -106,7 +132,7 @@ const ids = ref([])
|
|||||||
const single = ref(true)
|
const single = ref(true)
|
||||||
const multiple = ref(true)
|
const multiple = ref(true)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const title = ref("")
|
const title = ref('')
|
||||||
const daterangeCreateTime = ref([])
|
const daterangeCreateTime = ref([])
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
@ -116,31 +142,31 @@ const data = reactive({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
sheepfold: null,
|
sheepfold: null,
|
||||||
|
varietyId: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
id: [
|
|
||||||
{ required: true, message: "$comment不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
sheepId: [
|
sheepId: [
|
||||||
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
{ required: true, message: '羊只id不能为空', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
sheepfold: [
|
sheepfold: [
|
||||||
{ required: true, message: "羊舍id不能为空", trigger: "change" }
|
{ required: true, message: '羊舍id不能为空', trigger: 'change' }
|
||||||
|
],
|
||||||
|
varietyId: [
|
||||||
|
{ required: true, message: '品种不能为空', trigger: 'change' }
|
||||||
],
|
],
|
||||||
technician: [
|
technician: [
|
||||||
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
{ required: true, message: '技术员不能为空', trigger: 'blur' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
/** 查询修蹄列表 */
|
/* 列表 */
|
||||||
function getList () {
|
function getList () {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
// 空字符串转 null
|
|
||||||
const q = { ...queryParams.value }
|
const q = { ...queryParams.value }
|
||||||
if (q.sheepId === '') q.sheepId = null
|
if (q.sheepId === '') q.sheepId = null
|
||||||
if (q.sheepfold === '') q.sheepfold = null
|
if (q.sheepfold === '') q.sheepfold = null
|
||||||
@ -156,114 +182,114 @@ function getList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
|
||||||
function cancel () {
|
function cancel () {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
|
||||||
function reset () {
|
function reset () {
|
||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
id: null,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
sheepfold: null,
|
sheepfold: null,
|
||||||
|
varietyId: null,
|
||||||
comment: null,
|
comment: null,
|
||||||
technician: null,
|
technician: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null
|
createTime: null
|
||||||
}
|
}
|
||||||
proxy.resetForm("fixHoofRef")
|
proxy.resetForm('fixHoofRef')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
function handleQuery () {
|
function handleQuery () {
|
||||||
queryParams.value.pageNum = 1
|
queryParams.value.pageNum = 1
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
function resetQuery () {
|
function resetQuery () {
|
||||||
daterangeCreateTime.value = []
|
daterangeCreateTime.value = []
|
||||||
proxy.resetForm("queryRef")
|
proxy.resetForm('queryRef')
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多选框选中数据
|
|
||||||
function handleSelectionChange (selection) {
|
function handleSelectionChange (selection) {
|
||||||
ids.value = selection.map(item => item.id)
|
ids.value = selection.map(item => item.id)
|
||||||
single.value = selection.length != 1
|
single.value = selection.length !== 1
|
||||||
multiple.value = !selection.length
|
multiple.value = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
function handleAdd () {
|
function handleAdd () {
|
||||||
reset()
|
reset()
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "添加修蹄"
|
title.value = '添加修蹄'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
function handleUpdate (row) {
|
function handleUpdate (row) {
|
||||||
reset()
|
reset()
|
||||||
const _id = row.id || ids.value
|
const _id = row.id || ids.value
|
||||||
getFixHoof(_id).then(response => {
|
getFixHoof(_id).then(res => {
|
||||||
form.value = response.data
|
form.value = res.data
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "修改修蹄"
|
title.value = '修改修蹄'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
function submitForm () {
|
function submitForm () {
|
||||||
proxy.$refs["fixHoofRef"].validate(valid => {
|
proxy.$refs.fixHoofRef.validate(valid => {
|
||||||
if (valid) {
|
if (!valid) return
|
||||||
if (form.value.id != null) {
|
if (form.value.id) {
|
||||||
updateFixHoof(form.value).then(response => {
|
updateFixHoof(form.value).then(() => {
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess('修改成功')
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addFixHoof(form.value).then(response => {
|
addFixHoof(form.value).then(() => {
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
proxy.$modal.msgSuccess('新增成功')
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
function handleDelete (row) {
|
function handleDelete (row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除修蹄编号为"' + _ids + '"的数据项?').then(function () {
|
proxy.$modal.confirm(`是否确认删除修蹄编号为"${_ids}"的数据项?`).then(() => {
|
||||||
return delFixHoof(_ids)
|
return delFixHoof(_ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList()
|
getList()
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
}).catch(() => { })
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
function handleExport () {
|
function handleExport () {
|
||||||
proxy.download('/produce/other/fixHoof/export', {
|
proxy.download('/produce/other/fixHoof/export', { ...queryParams.value }, `fixHoof_${new Date().getTime()}.xlsx`)
|
||||||
...queryParams.value
|
|
||||||
}, `fixHoof_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**加载所有羊舍*/
|
/* 下拉数据 */
|
||||||
const sheepfoldOptions = ref([]);
|
const sheepfoldOptions = ref([])
|
||||||
function getSheepfoldOptions () {
|
function getSheepfoldOptions () {
|
||||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||||
sheepfoldOptions.value = res.rows;
|
sheepfoldOptions.value = res.rows
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
|
||||||
getList();
|
|
||||||
getSheepfoldOptions();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const varietyOptions = ref([])
|
||||||
|
function getVarietyOptions () {
|
||||||
|
request({
|
||||||
|
url: '/base/variety/list',
|
||||||
|
method: 'get',
|
||||||
|
params: { pageNum: 1, pageSize: 9999 }
|
||||||
|
}).then(res => {
|
||||||
|
varietyOptions.value = res.rows || []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 只保留一个 onMounted */
|
||||||
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
|
getSheepfoldOptions()
|
||||||
|
getVarietyOptions()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user