Merge branch 'main' of http://e19510c831.iok.la/admin/zhyc-sheep-ui
This commit is contained in:
commit
da5a15167c
@ -21,6 +21,7 @@
|
||||
"@vueuse/core": "10.11.0",
|
||||
"axios": "0.28.1",
|
||||
"clipboard": "2.0.11",
|
||||
"date-fns": "^4.1.0",
|
||||
"echarts": "5.5.1",
|
||||
"element-plus": "^2.7.6",
|
||||
"file-saver": "2.0.5",
|
||||
|
@ -1,44 +1,29 @@
|
||||
// src/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询羊奶出入库列表
|
||||
export function listMilkInOutStore(query) {
|
||||
// 查询羊奶产量分析列表(分页 + 条件)
|
||||
export function listSheepMilkAnalysis(query) {
|
||||
return request({
|
||||
url: '/milkInOutStore/milkInOutStore/list',
|
||||
url: '/dairyProducts/sheepMilkAnalysis/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询羊奶出入库详细
|
||||
export function getMilkInOutStore(id) {
|
||||
// 查询单个羊奶产量分析详细信息
|
||||
export function getSheepMilkAnalysis(sheepId) {
|
||||
return request({
|
||||
url: '/milkInOutStore/milkInOutStore/' + id,
|
||||
url: '/dairyProducts/sheepMilkAnalysis/' + sheepId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增羊奶出入库
|
||||
export function addMilkInOutStore(data) {
|
||||
// 导出羊奶产量分析 Excel
|
||||
export function exportSheepMilkAnalysis(query) {
|
||||
return request({
|
||||
url: '/milkInOutStore/milkInOutStore',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改羊奶出入库
|
||||
export function updateMilkInOutStore(data) {
|
||||
return request({
|
||||
url: '/milkInOutStore/milkInOutStore',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除羊奶出入库
|
||||
export function delMilkInOutStore(id) {
|
||||
return request({
|
||||
url: '/milkInOutStore/milkInOutStore/' + id,
|
||||
method: 'delete'
|
||||
url: '/dairyProducts/sheepMilkAnalysis/export',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob' // 返回二进制流
|
||||
})
|
||||
}
|
||||
|
44
src/api/feed/FeedPlan.js
Normal file
44
src/api/feed/FeedPlan.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询饲喂计划列表
|
||||
export function listFeedPlan(query) {
|
||||
return request({
|
||||
url: '/feed/FeedPlan/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询饲喂计划详细
|
||||
export function getFeedPlan(createDate) {
|
||||
return request({
|
||||
url: '/feed/FeedPlan/' + createDate,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增饲喂计划
|
||||
export function addFeedPlan(data) {
|
||||
return request({
|
||||
url: '/feed/FeedPlan',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改饲喂计划
|
||||
export function updateFeedPlan(data) {
|
||||
return request({
|
||||
url: '/feed/FeedPlan',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除饲喂计划
|
||||
export function delFeedPlan(createDate) {
|
||||
return request({
|
||||
url: '/feed/FeedPlan/' + createDate,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
src/api/feed/FormulaList.js
Normal file
44
src/api/feed/FormulaList.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询配方列表列表
|
||||
export function listFormulaList(query) {
|
||||
return request({
|
||||
url: '/feed/FormulaList/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询配方列表详细
|
||||
export function getFormulaList(code) {
|
||||
return request({
|
||||
url: '/feed/FormulaList/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增配方列表
|
||||
export function addFormulaList(data) {
|
||||
return request({
|
||||
url: '/feed/FormulaList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改配方列表
|
||||
export function updateFormulaList(data) {
|
||||
return request({
|
||||
url: '/feed/FormulaList',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除配方列表
|
||||
export function delFormulaList(code) {
|
||||
return request({
|
||||
url: '/feed/FormulaList/' + code,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
src/api/feed/FormulaManagement.js
Normal file
44
src/api/feed/FormulaManagement.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询配方管理列表
|
||||
export function listFormulaManagement(query) {
|
||||
return request({
|
||||
url: '/feed/FormulaManagement/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询配方管理详细
|
||||
export function getFormulaManagement(formulaId) {
|
||||
return request({
|
||||
url: '/feed/FormulaManagement/' + formulaId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增配方管理
|
||||
export function addFormulaManagement(data) {
|
||||
return request({
|
||||
url: '/feed/FormulaManagement',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改配方管理
|
||||
export function updateFormulaManagement(data) {
|
||||
return request({
|
||||
url: '/feed/FormulaManagement',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除配方管理
|
||||
export function delFormulaManagement(formulaIdAndBatchId) {
|
||||
return request({
|
||||
url: '/feed/FormulaManagement/' + formulaIdAndBatchId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
src/api/feed/Material.js
Normal file
44
src/api/feed/Material.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询原料列表
|
||||
export function listMaterial(query) {
|
||||
return request({
|
||||
url: '/feed/material/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询原料详细
|
||||
export function getMaterial(materialId) {
|
||||
return request({
|
||||
url: '/feed/material/' + materialId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增原料
|
||||
export function addMaterial(data) {
|
||||
return request({
|
||||
url: '/feed/material',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改原料
|
||||
export function updateMaterial(data) {
|
||||
return request({
|
||||
url: '/feed/material',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除原料
|
||||
export function delMaterial(materialId) {
|
||||
return request({
|
||||
url: '/feed/material/' + materialId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
<el-input v-model="queryParams.manageEarTag" placeholder="请输入耳号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="筛选天数">
|
||||
<el-input-number v-model="queryParams.screenDays" :min="0" placeholder="请输入天数" />
|
||||
<el-input-number v-model="queryParams.screenDays" :min="1" placeholder="请输入天数" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
@ -18,34 +18,25 @@
|
||||
<div class="button-group">
|
||||
<el-button type="success" @click="handleExport">导出</el-button>
|
||||
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
width="400"
|
||||
trigger="click"
|
||||
>
|
||||
<el-checkbox-group v-model="selectedFields" class="checkbox-columns">
|
||||
<el-checkbox
|
||||
v-for="col in allColumns"
|
||||
:key="col.prop"
|
||||
:label="col.prop"
|
||||
>{{ col.label }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
|
||||
<template #reference>
|
||||
<el-button type="info">展示列</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
|
||||
<el-popover placement="bottom" width="400" trigger="click">
|
||||
<el-checkbox-group v-model="selectedFields" class="checkbox-columns">
|
||||
<el-checkbox v-for="col in allColumns" :key="col.prop" :label="col.prop">{{ col.label }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<template #reference>
|
||||
<el-button type="info">展示列</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table :data="list" border style="width: 100%" v-loading="loading" :row-key="row => row.id">
|
||||
<el-table :data="list" border style="width: 100%" v-loading="loading" :row-key="row => row.sheepId">
|
||||
<el-table-column
|
||||
v-for="col in visibleColumns"
|
||||
:key="col.prop"
|
||||
:label="col.label"
|
||||
:prop="col.prop"
|
||||
:min-width="col.minWidth || 120"
|
||||
:formatter="col.formatter || undefined"
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
@ -65,6 +56,7 @@
|
||||
|
||||
<script>
|
||||
import { listSheepMilkAnalysis, exportSheepMilkAnalysis } from "@/api/dairyProducts/sheepMilkAnalysis/sheepMilkAnalysis.js";
|
||||
import { format } from 'date-fns';
|
||||
|
||||
export default {
|
||||
name: "SheepMilkAnalysis",
|
||||
@ -77,47 +69,47 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
manageEarTag: null,
|
||||
screenDays: null
|
||||
screenDays: 100 // 默认筛选天数
|
||||
},
|
||||
selectedFields: [],
|
||||
allColumns: [
|
||||
{ label: "耳号", prop: "manageEarTag" },
|
||||
{ label: "品种", prop: "variety" },
|
||||
{ label: "挤奶时间", prop: "milkingDate" },
|
||||
{ label: "干奶时间", prop: "dryDate" },
|
||||
{ label: "筛选天数", prop: "screeningDays" },
|
||||
{ label: "挤奶开始时间", prop: "milkingStartTime", formatter: row => row.milkingStartTime ? format(new Date(row.milkingStartTime),'yyyy-MM-dd') : '' },
|
||||
{ label: "干奶时间", prop: "dryEndTime", formatter: row => row.dryEndTime ? format(new Date(row.dryEndTime),'yyyy-MM-dd') : '' },
|
||||
{ label: "筛选天数", prop: "screenDays" },
|
||||
{ label: "挤奶天数", prop: "milkingDays" },
|
||||
{ label: "校正后最大胎次", prop: "maxCorrectedParity" },
|
||||
{ label: "系统奶量之合计", prop: "systemMilkTotal" },
|
||||
{ label: "校正奶量之合计", prop: "correctedMilkTotal" },
|
||||
{ label: "校正日平均奶量", prop: "avgDailyCorrectedMilk" },
|
||||
{ label: "胎次1的总产奶量", prop: "parity1TotalMilk" },
|
||||
{ label: "胎次2的总产奶量", prop: "parity2TotalMilk" },
|
||||
{ label: "胎次3的总产奶量", prop: "parity3TotalMilk" },
|
||||
{ label: "胎次4的总产奶量", prop: "parity4TotalMilk" },
|
||||
{ label: "胎次1的日平均产量", prop: "parity1AvgDailyMilk" },
|
||||
{ label: "胎次2的日平均产量", prop: "parity2AvgDailyMilk" },
|
||||
{ label: "胎次3的日平均产量", prop: "parity3AvgDailyMilk" },
|
||||
{ label: "胎次4的日平均产量", prop: "parity4AvgDailyMilk" },
|
||||
{ label: "校正后最大胎次", prop: "maxParity" },
|
||||
{ label: "系统奶量之合计", prop: "sumSystemMilk" },
|
||||
{ label: "校正奶量之合计", prop: "sumCorrectedMilk" },
|
||||
{ label: "校正日平均奶量", prop: "avgCorrectedDaily" },
|
||||
{ label: "胎次1的总奶量", prop: "sumParity1Milk" },
|
||||
{ label: "胎次2的总奶量", prop: "sumParity2Milk" },
|
||||
{ label: "胎次3的总奶量", prop: "sumParity3Milk" },
|
||||
{ label: "胎次4的总奶量", prop: "sumParity4Milk" },
|
||||
{ label: "胎次1日平均", prop: "avgParity1Daily" },
|
||||
{ label: "胎次2日平均", prop: "avgParity2Daily" },
|
||||
{ label: "胎次3日平均", prop: "avgParity3Daily" },
|
||||
{ label: "胎次4日平均", prop: "avgParity4Daily" },
|
||||
{ label: "泌乳天数", prop: "lactationDays" },
|
||||
{ label: "过去7日日平均奶量", prop: "past7DaysAvgMilk" },
|
||||
{ label: "校正过去7日日平均奶量", prop: "past7DaysAvgCorrectedMilk" },
|
||||
{ label: "过去14日日平均奶量", prop: "past14DaysAvgMilk" },
|
||||
{ label: "过去30日日平均奶量", prop: "past30DaysAvgMilk" },
|
||||
{ label: "羊只类型", prop: "sheepType" },
|
||||
{ label: "生日", prop: "birthDate" },
|
||||
{ label: "当前胎次", prop: "currentParity" },
|
||||
{ label: "月龄", prop: "ageMonths" },
|
||||
{ label: "过去7日均奶量", prop: "avgLast7Milk" },
|
||||
{ label: "校正过去7日均", prop: "avgLast7Corrected" },
|
||||
{ label: "过去14日均奶量", prop: "avgLast14Milk" },
|
||||
{ label: "过去30日均奶量", prop: "avgLast30Milk" },
|
||||
{ label: "羊只类别", prop: "sheepCategory" },
|
||||
{ label: "生日", prop: "birthday", formatter: row => row.birthday ? format(new Date(row.birthday),'yyyy-MM-dd') : '' },
|
||||
{ label: "当前胎次", prop: "parity" },
|
||||
{ label: "月龄", prop: "monthAge" },
|
||||
{ label: "当前体重", prop: "currentWeight" },
|
||||
{ label: "繁育状态", prop: "breedStatus" },
|
||||
{ label: "父号", prop: "fatherTag" },
|
||||
{ label: "母号", prop: "motherTag" },
|
||||
{ label: "牧场名称", prop: "ranchName" },
|
||||
{ label: "家系", prop: "familyLine" },
|
||||
{ label: "父号", prop: "fatherManageTags" },
|
||||
{ label: "母号", prop: "motherManageTags" },
|
||||
{ label: "牧场", prop: "ranchName" },
|
||||
{ label: "家系", prop: "family" },
|
||||
{ label: "母亲挤奶天数", prop: "motherMilkingDays" },
|
||||
{ label: "母亲校正奶量之合计", prop: "motherCorrectedMilkTotal" },
|
||||
{ label: "母亲校正后最大胎次", prop: "motherMaxCorrectedParity" },
|
||||
{ label: "母亲校正日平均奶量", prop: "motherAvgDailyCorrectedMilk" }
|
||||
{ label: "母亲校正奶量之合计", prop: "motherSumCorrected" },
|
||||
{ label: "母亲校正后最大胎次", prop: "motherMaxParity" },
|
||||
{ label: "母亲校正日平均奶量", prop: "motherAvgCorrectedDaily" }
|
||||
]
|
||||
};
|
||||
},
|
||||
@ -134,10 +126,12 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listSheepMilkAnalysis(this.queryParams).then(response => {
|
||||
this.list = response.rows;
|
||||
this.total = response.total;
|
||||
// 兼容可能的 axios wrapper:有的返回 { data: { rows, total } }, 有的直接返回 { rows, total }
|
||||
const res = response && response.data ? response.data : response;
|
||||
this.list = res.rows || res;
|
||||
this.total = res.total || (Array.isArray(this.list) ? this.list.length : 0);
|
||||
this.loading = false;
|
||||
});
|
||||
}).catch(()=>{ this.loading = false; });
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
@ -148,7 +142,7 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
manageEarTag: null,
|
||||
screenDays: null
|
||||
screenDays: 100
|
||||
};
|
||||
this.selectedFields = this.allColumns.map(c => c.prop);
|
||||
this.getList();
|
||||
@ -163,7 +157,8 @@ export default {
|
||||
},
|
||||
handleExport() {
|
||||
exportSheepMilkAnalysis(this.queryParams).then(response => {
|
||||
const blob = new Blob([response], { type: 'application/vnd.ms-excel' });
|
||||
const data = response && response.data ? response.data : response;
|
||||
const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
@ -171,6 +166,9 @@ export default {
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}).catch(err => {
|
||||
this.$message.error('导出失败,请检查后端是否正确返回文件流');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
347
src/views/feed/FeedPlan/index.vue
Normal file
347
src/views/feed/FeedPlan/index.vue
Normal file
@ -0,0 +1,347 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="配方编码" prop="formulaId">
|
||||
<el-input
|
||||
v-model="queryParams.formulaId"
|
||||
placeholder="请输入配方编码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||
<el-input
|
||||
v-model="queryParams.sheepHouseId"
|
||||
placeholder="请输入羊舍"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||
<el-input
|
||||
v-model="queryParams.zookeeper"
|
||||
placeholder="请输入饲草班人员"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="饲喂计划日期" prop="planDate">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.planDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择饲喂计划日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['feed:FeedPlan:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['feed:FeedPlan:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['feed:FeedPlan:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['feed:FeedPlan:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :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" />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepHouseId">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sheep_house_list" :value="scope.row.sheepHouseId"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="羊只数量" align="center" prop="sheepCount" />
|
||||
<el-table-column label="日均计划量" align="center" prop="planDailySize" />
|
||||
<el-table-column label="计划量(早)" align="center" prop="planMorningSize" />
|
||||
<el-table-column label="计划总量(早)" align="center" prop="planMorningTotal" />
|
||||
<el-table-column label="饲喂比例(早)" align="center" prop="ratioMorning" />
|
||||
<el-table-column label="实际量(早)" align="center" prop="actualMorningSize" />
|
||||
<el-table-column label="计划量(中)" align="center" prop="planNoonSize" />
|
||||
<el-table-column label="计划总量(中)" align="center" prop="planNoonTotal" />
|
||||
<el-table-column label="实际量(中)" align="center" prop="actualNoonSize" />
|
||||
<el-table-column label="饲喂比例(中)" align="center" prop="ratioNoon" />
|
||||
<el-table-column label="计划量(下)" align="center" prop="planAfternoonSize" />
|
||||
<el-table-column label="计划总量(下)" align="center" prop="planAfternoonTotal" />
|
||||
<el-table-column label="实际量(下)" align="center" prop="actualAfternoonSize" />
|
||||
<el-table-column label="饲喂比例(下)" align="center" prop="ratioAfternoon" />
|
||||
<el-table-column label="计划饲喂总量" align="center" prop="planFeedTotal" />
|
||||
<el-table-column label="饲草班人员" align="center" prop="zookeeper" />
|
||||
<el-table-column label="饲喂计划日期" align="center" prop="planDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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:FeedPlan:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['feed:FeedPlan: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="FeedPlanRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="配方编码" prop="formulaId">
|
||||
<el-input v-model="form.formulaId" placeholder="请输入配方编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||
<el-input v-model="form.sheepHouseId" placeholder="请输入羊舍" />
|
||||
</el-form-item>
|
||||
<el-form-item label="日均计划量" prop="planDailySize">
|
||||
<el-input v-model="form.planDailySize" placeholder="请输入日均计划量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="饲喂比例(早)" prop="ratioMorning">
|
||||
<el-input v-model="form.ratioMorning" placeholder="请输入饲喂比例(早)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际量(早)" prop="actualMorningSize">
|
||||
<el-input v-model="form.actualMorningSize" placeholder="请输入实际量(早)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际量(中)" prop="actualNoonSize">
|
||||
<el-input v-model="form.actualNoonSize" placeholder="请输入实际量(中)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="饲喂比例(中)" prop="ratioNoon">
|
||||
<el-input v-model="form.ratioNoon" placeholder="请输入饲喂比例(中)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际量(下)" prop="actualAfternoonSize">
|
||||
<el-input v-model="form.actualAfternoonSize" placeholder="请输入实际量(下)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="饲喂比例(下)" prop="ratioAfternoon">
|
||||
<el-input v-model="form.ratioAfternoon" placeholder="请输入饲喂比例(下)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||
<el-input v-model="form.zookeeper" placeholder="请输入饲草班人员" />
|
||||
</el-form-item>
|
||||
<el-form-item label="饲喂计划日期" prop="planDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.planDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择饲喂计划日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</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="FeedPlan">
|
||||
import { listFeedPlan, getFeedPlan, delFeedPlan, addFeedPlan, updateFeedPlan } from "@/api/feed/FeedPlan"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const FeedPlanList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
formulaId: null,
|
||||
sheepHouseId: null,
|
||||
zookeeper: null,
|
||||
planDate: null,
|
||||
},
|
||||
rules: {
|
||||
formulaId: [
|
||||
{ required: true, message: "配方编码不能为空", trigger: "blur" }
|
||||
],
|
||||
sheepHouseId: [
|
||||
{ required: true, message: "羊舍不能为空", trigger: "blur" }
|
||||
],
|
||||
planDailySize: [
|
||||
{ required: true, message: "日均计划量不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询饲喂计划列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listFeedPlan(queryParams.value).then(response => {
|
||||
FeedPlanList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
createDate: null,
|
||||
formulaId: null,
|
||||
sheepHouseId: null,
|
||||
sheepCount: null,
|
||||
planDailySize: null,
|
||||
planMorningSize: null,
|
||||
planMorningTotal: null,
|
||||
ratioMorning: null,
|
||||
actualMorningSize: null,
|
||||
planNoonSize: null,
|
||||
planNoonTotal: null,
|
||||
actualNoonSize: null,
|
||||
ratioNoon: null,
|
||||
planAfternoonSize: null,
|
||||
planAfternoonTotal: null,
|
||||
actualAfternoonSize: null,
|
||||
ratioAfternoon: null,
|
||||
planFeedTotal: null,
|
||||
zookeeper: null,
|
||||
planDate: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("FeedPlanRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.createDate)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加饲喂计划"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _createDate = row.createDate || ids.value
|
||||
getFeedPlan(_createDate).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改饲喂计划"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["FeedPlanRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.createDate != null) {
|
||||
updateFeedPlan(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addFeedPlan(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _createDates = row.createDate || ids.value
|
||||
proxy.$modal.confirm('是否确认删除饲喂计划编号为"' + _createDates + '"的数据项?').then(function() {
|
||||
return delFeedPlan(_createDates)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/FeedPlan/export', {
|
||||
...queryParams.value
|
||||
}, `FeedPlan_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
229
src/views/feed/FormulaList/index.vue
Normal file
229
src/views/feed/FormulaList/index.vue
Normal file
@ -0,0 +1,229 @@
|
||||
<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="ratio">
|
||||
<el-input v-model="queryParams.ratio" placeholder="请输入比例" clearable @keyup.enter="handleQuery" />
|
||||
</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:FormulaList:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['feed:FormulaList:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['feed:FormulaList:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['feed:FormulaList:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :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" />
|
||||
<el-table-column label="原料编号" align="center" prop="materialId" />
|
||||
<el-table-column label="原料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="比例" align="center" prop="ratio" />
|
||||
<el-table-column label="颗粒原料" align="center" prop="isGranular" />
|
||||
<el-table-column label="补饲" align="center" prop="isSupplement" />
|
||||
<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:FormulaList:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['feed:FormulaList: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="FormulaListRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="原料编号" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入原料编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入原料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="比例" prop="ratio">
|
||||
<el-input v-model="form.ratio" placeholder="请输入比例" />
|
||||
</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="FormulaList">
|
||||
import { listFormulaList, getFormulaList, delFormulaList, addFormulaList, updateFormulaList } from "@/api/feed/FormulaList"
|
||||
import { reactive } from "vue"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const FormulaListList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
batchId: "0",
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: null,
|
||||
isSupplement: null
|
||||
},
|
||||
rules: {
|
||||
ratio: [
|
||||
{ required: true, message: "比例不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
|
||||
/** 查询配方列表列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listFormulaList(queryParams.value).then(response => {
|
||||
FormulaListList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
code: null,
|
||||
formulaId: null,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: null,
|
||||
isSupplement: null
|
||||
}
|
||||
proxy.resetForm("FormulaListRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.code)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加配方列表"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _code = row.code || ids.value
|
||||
getFormulaList(_code).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改配方列表"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["FormulaListRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.code != null) {
|
||||
updateFormulaList(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addFormulaList(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _codes = row.code || ids.value
|
||||
proxy.$modal.confirm('是否确认删除配方列表编号为"' + _codes + '"的数据项?').then(function () {
|
||||
return delFormulaList(_codes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/FormulaList/export', {
|
||||
...queryParams.value
|
||||
}, `FormulaList_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
717
src/views/feed/FormulaManagement/index.vue
Normal file
717
src/views/feed/FormulaManagement/index.vue
Normal file
@ -0,0 +1,717 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="饲养阶段" prop="feedStage">
|
||||
<el-input v-model="queryParams.feedStage" placeholder="请输入饲养阶段" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="批号" prop="batchId">
|
||||
<el-input v-model="queryParams.batchId" placeholder="请输入批号" clearable @keyup.enter="handleQuery" />
|
||||
</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="handleAddFormulatemplate"
|
||||
v-hasPermi="['feed:FormulaManagement:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['feed:FormulaManagement:edit']" v-show="false">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['feed:FormulaManagement:remove']" v-show="false">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['feed:FormulaManagement:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="FormulaManagementList">
|
||||
<!-- 表中表展示子配方 -->
|
||||
<el-table-column type="expand" @expand-change="handleExpandChange">
|
||||
<template #default="props">
|
||||
<el-table :data="props.row.subFormulaList" style="width: 100%">
|
||||
<el-table-column label="批号" align="center" prop="batchId" />
|
||||
<el-table-column label="饲养阶段" align="center" prop="feedStage" />
|
||||
<el-table-column label="开始使用时间" align="center" prop="useStartDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.useStartDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束使用时间" align="center" prop="useEndDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.useEndDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用状态" align="center" prop="useState">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="pres_status" :value="scope.row.useState" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleFormulaDetailUpdate(scope.row)"
|
||||
v-hasPermi="['feed:FormulaManagement:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleFormulaDelete(scope.row)"
|
||||
v-hasPermi="['feed:FormulaManagement:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配方编号" align="center" prop="formulaId" />
|
||||
<el-table-column label="饲养阶段" align="center" prop="feedStage" />
|
||||
<el-table-column label="使用状态" align="center" prop="useState">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="pres_status" :value="scope.row.useState" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAddSgFormulaList(scope.row)"
|
||||
v-hasPermi="['feed:FormulaManagement:add']">新增</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleFormulaTemplateUpdate(scope.row)"
|
||||
v-hasPermi="['feed:FormulaManagement:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleFormulaDelete(scope.row)"
|
||||
v-hasPermi="['feed:FormulaManagement: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="FormulaManagementRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="饲养阶段" prop="feedStage">
|
||||
<el-input v-model="form.feedStage" placeholder="请输入饲养阶段" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开始使用时间" prop="useStartDate">
|
||||
<el-date-picker clearable v-model="form.useStartDate" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择开始使用时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束使用时间" prop="useEndDate">
|
||||
<el-date-picker clearable v-model="form.useEndDate" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择结束使用时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</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>
|
||||
|
||||
<!-- 弹框:详情/修改 -->
|
||||
<el-dialog :title="title" v-model="formulaListOpen" width="60%" append-to-body s>
|
||||
<!-- 详情页:只读展示 -->
|
||||
<div v-if="isView" style="padding-bottom:20px ;">
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="配方批号">{{ showFormulaManagementList.batchId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="饲养阶段">{{ showFormulaManagementList.feedStage }}</el-descriptions-item>
|
||||
<el-descriptions-item label="开始使用时间">
|
||||
<span>{{ parseTime(showFormulaManagementList.useStartDate, '{y}-{m}-{d}') }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结束使用时间">
|
||||
<span>{{ parseTime(showFormulaManagementList.useEndDate, '{y}-{m}-{d}') }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="使用状态">
|
||||
<dict-tag :options="pres_status" :value="showFormulaManagementList.useState" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">
|
||||
{{ showFormulaManagementList.remark || '无' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider content-position="left">配方列表</el-divider>
|
||||
|
||||
<el-table :data="showFormulaManagementList.sgFormulaList" stripe border style="width: 100%" max-height="300">
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="原料编号" prop="materialId" align="center" />
|
||||
<el-table-column label="原料名称" prop="materialName" />
|
||||
<el-table-column label="比例" align="center" prop="ratio" />
|
||||
<el-table-column label="类型" prop="isGranular" align="center">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="materialType" :value="scope.row.isGranular" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 修改页:可编辑表单 -->
|
||||
<div v-else>
|
||||
<el-form ref="FormulaManagementRef" :model="showFormulaManagementList" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" v-if="!isView">
|
||||
<el-form-item label="配方编号" prop="formulaId">
|
||||
<el-input v-model="showFormulaManagementList.formulaId" placeholder="请输入配方编号"
|
||||
:disabled="!FormulaIdEditable"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="批号" prop="batchId">
|
||||
<el-input v-model="showFormulaManagementList.batchId" placeholder="请输入配方批号"
|
||||
:disabled="!BatchIdEditable" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="饲养阶段" prop="feedStage">
|
||||
<el-input v-model="showFormulaManagementList.feedStage" placeholder="请输入饲养阶段" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始使用时间" prop="useStartDate">
|
||||
<el-date-picker clearable v-model="showFormulaManagementList.useStartDate" type="date"
|
||||
value-format="YYYY-MM-DD" placeholder="请选择开始使用时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结束使用时间" prop="useEndDate">
|
||||
<el-date-picker clearable v-model="showFormulaManagementList.useEndDate" type="date"
|
||||
value-format="YYYY-MM-DD" placeholder="请选择结束使用时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用状态" prop="useState">
|
||||
<el-select v-model="showFormulaManagementList.useState" placeholder="请选择使用状态">
|
||||
<el-option v-for="item in useStaus" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :rows="2" v-model="showFormulaManagementList.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider content-position="left">配方详情</el-divider>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" icon="Plus" @click="handleAddSgFormulaListDetail()">添加</el-button>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-table :data="showFormulaManagementList.sgFormulaList" :rules="rules"
|
||||
:row-class-name="rowSgFormulaListDetailIndex" @selection-change="handleSgFormulaListDetailSelectionChange"
|
||||
ref="swPresDetail" border stripe>
|
||||
<el-table-column label="序号" align="center" prop="index" width="60" />
|
||||
<el-table-column label="原料" prop="materialId">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.materialId" filterable placeholder="请选择原料" style="width: 100%"
|
||||
@change="handleMaterialChange(scope.row, $event)">
|
||||
<el-option v-for="item in materials" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="比例" prop="dosage">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.ratio" placeholder="请输入比例" :min="0" :precision="1"
|
||||
controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" prop="isGranular">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.isGranular" placeholder="请选择类型">
|
||||
<el-option v-for="item in materialType" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</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="Delete" @click="deleteFormulaListDetail(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 底部按钮:仅修改页显示 -->
|
||||
<template #footer v-if="!isView">
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitFormulaListForm">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</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)
|
||||
|
||||
/**
|
||||
* 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 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 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
* 根据 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
|
||||
}))
|
||||
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
|
||||
}
|
||||
|
||||
/** ================================= */
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/FormulaManagement/export', {
|
||||
...queryParams.value
|
||||
}, `FormulaManagement_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
// 初始化加载数据
|
||||
getList()
|
||||
// 加载原料列表
|
||||
getMaterials()
|
||||
</script>
|
@ -20,16 +20,16 @@
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['stock:in:add']">新增</el-button>
|
||||
<el-col :span="1.5" >
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['stock:in:add']" v-show="false">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['stock:in:edit']">修改</el-button>
|
||||
v-hasPermi="['stock:in:edit']" v-show="false">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['stock:in:remove']">删除</el-button>
|
||||
v-hasPermi="['stock:in:remove']" v-show="false">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
@ -119,6 +119,7 @@
|
||||
<script setup name="In">
|
||||
import { listIn, getIn, delIn, addIn, updateIn } from "@/api/stock/in"
|
||||
import { getToken } from "@/utils/auth"
|
||||
import { isVisible } from "element-plus/es/utils/index.mjs"
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const inList = ref([])
|
||||
|
@ -97,9 +97,43 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改物资管理对话框 -->
|
||||
<!-- 添加或修改饲喂计划对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="managementRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="存货编码" prop="materialId">
|
||||
<el-input v-model="form.materialId" placeholder="请输入存货编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="存货" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入存货名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="批号" prop="batchId">
|
||||
<el-input v-model="form.batchId" placeholder="请输入批号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="materialSpecification">
|
||||
<el-input v-model="form.materialSpecification" placeholder="请输入规格型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主计量" prop="materialUnit">
|
||||
<el-input v-model="form.materialUnit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="现存量" prop="currentStock">
|
||||
<el-input v-model="form.currentStock" placeholder="请输入现存量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产日期" prop="productionDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.productionDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择生产日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="失效日期" prop="expirationDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.expirationDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择失效日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
|
@ -21,15 +21,15 @@
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['stock:out:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['stock:out:add']" v-show="false">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['stock:out:edit']">修改</el-button>
|
||||
v-hasPermi="['stock:out:edit']" v-show="false">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['stock:out:remove']">删除</el-button>
|
||||
v-hasPermi="['stock:out:remove']" v-show="false">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
|
Loading…
x
Reference in New Issue
Block a user