Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
5f289eaadb
@ -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'
|
||||
})
|
||||
}
|
@ -42,3 +42,10 @@ export function delBody_measure(id) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
//获取羊只类别列表
|
||||
export function getSheepTypeList() {
|
||||
return request({
|
||||
url: '/base/base/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
44
src/api/stock/in.js
Normal file
44
src/api/stock/in.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询入库记录列表
|
||||
export function listIn(query) {
|
||||
return request({
|
||||
url: '/stock/in/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询入库记录详细
|
||||
export function getIn(stockInCode) {
|
||||
return request({
|
||||
url: '/stock/in/' + stockInCode,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增入库记录
|
||||
export function addIn(data) {
|
||||
return request({
|
||||
url: '/stock/in',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改入库记录
|
||||
export function updateIn(data) {
|
||||
return request({
|
||||
url: '/stock/in',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除入库记录
|
||||
export function delIn(stockInCode) {
|
||||
return request({
|
||||
url: '/stock/in/' + stockInCode,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
src/api/stock/management.js
Normal file
44
src/api/stock/management.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询物资管理列表
|
||||
export function listManagement(query) {
|
||||
return request({
|
||||
url: '/stock/management/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物资管理详细
|
||||
export function getManagement(materialManagementCode) {
|
||||
return request({
|
||||
url: '/stock/management/' + materialManagementCode,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物资管理
|
||||
export function addManagement(data) {
|
||||
return request({
|
||||
url: '/stock/management',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物资管理
|
||||
export function updateManagement(data) {
|
||||
return request({
|
||||
url: '/stock/management',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物资管理
|
||||
export function delManagement(materialManagementCode) {
|
||||
return request({
|
||||
url: '/stock/management/' + materialManagementCode,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
src/api/stock/out.js
Normal file
44
src/api/stock/out.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询出库记录列表
|
||||
export function listOut(query) {
|
||||
return request({
|
||||
url: '/stock/out/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询出库记录详细
|
||||
export function getOut(stockOutCode) {
|
||||
return request({
|
||||
url: '/stock/out/' + stockOutCode,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增出库记录
|
||||
export function addOut(data) {
|
||||
return request({
|
||||
url: '/stock/out',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改出库记录
|
||||
export function updateOut(data) {
|
||||
return request({
|
||||
url: '/stock/out',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除出库记录
|
||||
export function delOut(stockOutCode) {
|
||||
return request({
|
||||
url: '/stock/out/' + stockOutCode,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -68,7 +68,7 @@
|
||||
<el-table v-loading="loading" :data="diagnosisList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="耳号" align="center" prop="sheepNo" />
|
||||
<el-table-column label="时间日期" align="center" prop="datetime" width="180">
|
||||
<el-table-column label="时间日期" align="center" prop="datetime" width="150">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
@ -83,19 +83,19 @@
|
||||
<el-table-column label="诊疗结果" align="center" prop="result">
|
||||
<template #default="scope"><dict-tag :options="diag_result" :value="scope.row.result" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" align="center" prop="begindate">
|
||||
<el-table-column label="开始时间" align="center" prop="begindate" width="150">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.begindate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" align="center" prop="enddate">
|
||||
<el-table-column label="结束时间" align="center" prop="enddate" width="150">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.enddate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="治疗天数" align="center" prop="treatDay" />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfold" width="100px" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100px">
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfold" width="150px" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140px">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['diagnosis:diagnosis:edit']">修改</el-button>
|
||||
|
@ -34,7 +34,7 @@
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="disinfectList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName"/>
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" />
|
||||
<el-table-column label="消毒日期" align="center" prop="datetime" width="180">
|
||||
<template #default="scope">{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</template>
|
||||
</el-table-column>
|
||||
@ -164,7 +164,7 @@
|
||||
<el-form ref="editFormRef" :model="editForm" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="羊舍" >
|
||||
<el-form-item label="羊舍">
|
||||
<span>{{ editForm.sheepfoldName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -208,7 +208,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="用量" width="160">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.dosage" :min="0" :precision="1" />
|
||||
<el-input-number v-model="scope.row.dosage" :min="0" :precision="1" style="width: 120px;" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="120">
|
||||
|
@ -122,7 +122,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="用量" width="160">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.dosage" :min="0" :precision="1" />
|
||||
<el-input-number v-model="scope.row.dosage" :min="0" :precision="1" style="width: 120px;"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="120">
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
<el-table v-loading="loading" :data="medicineList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="" align="center" prop="id" />
|
||||
<el-table-column label="药品编号" align="center" prop="medica" />
|
||||
<el-table-column label="药品名称" align="center" prop="name" />
|
||||
<el-table-column label="药品类型" align="center" prop="medicType" :formatter="formatType"></el-table-column>
|
||||
|
@ -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('导出失败,请检查后端是否正确返回文件流');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
418
src/views/feed/FeedPlan/index.vue
Normal file
418
src/views/feed/FeedPlan/index.vue
Normal file
@ -0,0 +1,418 @@
|
||||
<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>
|
||||
<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="batchId" />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepHouseId">
|
||||
<template #default="scope">
|
||||
{{ getSheepHouseName(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="上午" prop="materialId" align="center">
|
||||
<el-table-column label="计划量" align="center" prop="planMorningSize">
|
||||
<template #default="{ row }">
|
||||
{{ row.planMorningSize ? row.planMorningSize.toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="计划总量" align="center" prop="planMorningTotal" /> -->
|
||||
<el-table-column label="实际量" align="center" prop="actualMorningSize" />
|
||||
</el-table-column>
|
||||
<el-table-column label="中午" prop="materialId" align="center">
|
||||
<el-table-column label="计划量" align="center" prop="planNoonSize">
|
||||
<template #default="{ row }">
|
||||
{{ row.planNoonSize ? row.planNoonSize.toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="计划总量" align="center" prop="planNoonTotal" /> -->
|
||||
<el-table-column label="实际量" align="center" prop="actualNoonSize" />
|
||||
</el-table-column>
|
||||
<el-table-column label="下午" prop="materialId" align="center">
|
||||
<el-table-column label="计划量" align="center" prop="planAfternoonSize">
|
||||
<template #default="{ row }">
|
||||
{{ row.planAfternoonSize ? row.planAfternoonSize.toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="计划总量" align="center" prop="planAfternoonTotal" /> -->
|
||||
<el-table-column label="实际量" align="center" prop="actualAfternoonSize" />
|
||||
</el-table-column>
|
||||
<el-table-column label="饲喂比例(%)" align="center" prop="ratioTotal">
|
||||
<el-table-column label="上午" align="center" prop="ratioMorning" />
|
||||
<el-table-column label="中午" align="center" prop="ratioNoon" />
|
||||
<el-table-column label="下午" align="center" prop="ratioAfternoon" />
|
||||
</el-table-column>
|
||||
|
||||
<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="100px">
|
||||
<el-form-item label="配方编码" prop="formulaId">
|
||||
<!-- <el-input v-model="form.formulaId" placeholder="请输入配方编码" /> -->
|
||||
<el-select v-model="form.formulaId" filterable placeholder="请选择配方编码" style="width: 100%"
|
||||
@change="handleFormulaIdChange(form, $event)">
|
||||
<el-option v-for="item in formulaIdDict" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批号" prop="batchId">
|
||||
<!-- <el-input v-model="form.batchId" placeholder="请输入批号" /> -->
|
||||
<el-select v-model="form.batchId" filterable placeholder="请选择配方批号" style="width: 100%">
|
||||
<el-option v-for="item in formulaBatchDict" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||
<!-- <el-input v-model="form.sheepHouseId" placeholder="请输入羊舍" /> -->
|
||||
<el-select v-model="form.sheepHouseId" filterable placeholder="请选择羊舍" style="width: 100%">
|
||||
<el-option v-for="item in sheepFolderDict" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="日均计划量" prop="planDailySize">
|
||||
<el-input v-model="form.planDailySize" placeholder="请输入日均计划量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="比例 (%)">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<el-input v-model="form.ratioMorning" placeholder="早上比例" style="width: 100px;" />
|
||||
<el-input v-model="form.ratioNoon" placeholder="中午比例" style="width: 100px;" />
|
||||
<el-input v-model="form.ratioAfternoon" placeholder="下午比例" style="width: 100px;" />
|
||||
</div>
|
||||
</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>
|
||||
<div v-if="title === '修改饲喂计划'">
|
||||
<el-divider content-position="left">配方详情</el-divider>
|
||||
<el-form-item label="实际饲喂量">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<el-input v-model="form.actualMorningSize" placeholder="早上" style="width: 100px;" />
|
||||
<el-input v-model="form.actualNoonSize" placeholder="中午" style="width: 100px;" />
|
||||
<el-input v-model="form.actualAfternoonSize" placeholder="下午" style="width: 100px;" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</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"
|
||||
import { listFormulaManagement } from "@/api/feed/FormulaManagement";
|
||||
import { listSheepfold } from "@/api/produce/manage_sheep/trans_group.js";
|
||||
import { get } from "@vueuse/core";
|
||||
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,
|
||||
},
|
||||
rules: {
|
||||
formulaId: [
|
||||
{ required: true, message: "配方编码不能为空", trigger: "blur" }
|
||||
],
|
||||
batchId: [
|
||||
{ required: true, message: "批号不能为空", trigger: "blur" }
|
||||
],
|
||||
sheepHouseId: [
|
||||
{ required: true, message: "羊舍不能为空", trigger: "blur" }
|
||||
],
|
||||
planDailySize: [
|
||||
{ required: true, message: "日均计划量不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const formulaIdDict = ref([]) // 配方编码字典
|
||||
// 用于存储配方批号列表
|
||||
const formulaBatchMap = ref([])
|
||||
const formulaBatchDict = ref([]) // 配方批号字典(过滤后)
|
||||
const sheepFolderDict = ref([]) // 羊舍字典
|
||||
// 用于存储羊舍名称的字典
|
||||
const sheepNameDict = ref({})
|
||||
|
||||
// 获取配方编码 & 配方批号 字典
|
||||
function getFormulaDict() {
|
||||
listFormulaManagement().then(response => {
|
||||
formulaIdDict.value = response.rows.map(item => ({
|
||||
label: item.formulaId,
|
||||
value: item.formulaId
|
||||
}))
|
||||
// 清空配方批号字典
|
||||
formulaBatchMap.value = []
|
||||
|
||||
// 遍历每个配方列表,提取子配方中的批号
|
||||
response.rows.forEach(item => {
|
||||
if (item.subFormulaList) {
|
||||
item.subFormulaList.forEach(subItem => {
|
||||
formulaBatchMap.value.push({
|
||||
label: subItem.batchId,
|
||||
value: subItem.batchId,
|
||||
formulaId: item.formulaId // 关联配方ID
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 处理配方编码变化
|
||||
function handleFormulaIdChange(row, value) {
|
||||
// 清空配方批号字典
|
||||
if (!value) {
|
||||
formulaBatchDict.value = []
|
||||
} else {
|
||||
// 根据选择的formulaId筛选batchId
|
||||
formulaBatchDict.value = formulaBatchMap.value;
|
||||
formulaBatchDict.value = formulaBatchDict.value.filter(item => item.formulaId === value)
|
||||
}
|
||||
|
||||
// 重新设置批号为第一个
|
||||
if (formulaBatchDict.value.length > 0) {
|
||||
row.batchId = formulaBatchDict.value[0].value;
|
||||
}
|
||||
}
|
||||
|
||||
function getSheepfoldDict() {
|
||||
listSheepfold().then(response => {
|
||||
sheepFolderDict.value = response.rows.map(item => ({
|
||||
label: item.sheepfoldName,
|
||||
value: item.id
|
||||
}))
|
||||
sheepNameDict.value = response.rows.map(item => ({
|
||||
label: item.id,
|
||||
value: item.sheepfoldName
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id获取羊舍名称
|
||||
function getSheepHouseName(id) {
|
||||
const dictItem = sheepFolderDict.value.find(item => item.value === id)
|
||||
return dictItem ? dictItem.label : id
|
||||
}
|
||||
|
||||
// 羊舍ID与名称转换函数:输入可以是 ID 或 羊舍名称
|
||||
function getSheepHouseId(inputValue, sheepNameDict) {
|
||||
if (!inputValue) return '';
|
||||
|
||||
// 输入是纯数字,直接返回
|
||||
if (/^\d+$/.test(inputValue)) {
|
||||
return inputValue;
|
||||
}
|
||||
|
||||
// 输入是名称,返回对应的 id
|
||||
const match = sheepNameDict.find(item => item.value === inputValue);
|
||||
return match ? match.label : '';
|
||||
}
|
||||
|
||||
|
||||
/** 查询饲喂计划列表 */
|
||||
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,
|
||||
batchId: null,
|
||||
sheepHouseId: null,
|
||||
sheepCount: null,
|
||||
planDailySize: null,
|
||||
ratioMorning: null,
|
||||
ratioNoon: null,
|
||||
ratioAfternoon: null,
|
||||
planMorningSize: null,
|
||||
planMorningTotal: null,
|
||||
actualMorningSize: null,
|
||||
planNoonSize: null,
|
||||
planNoonTotal: null,
|
||||
actualNoonSize: null,
|
||||
planAfternoonSize: null,
|
||||
planAfternoonTotal: null,
|
||||
actualAfternoonSize: null,
|
||||
planFeedTotal: null,
|
||||
zookeeper: null,
|
||||
planDate: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("FeedPlanRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
// 如果羊舍ID是名称,则转换为ID
|
||||
queryParams.value.sheepHouseId = getSheepHouseId(queryParams.value.sheepHouseId, sheepNameDict.value);
|
||||
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()
|
||||
// 获取配方编码字典
|
||||
getFormulaDict()
|
||||
// 获取羊舍字典
|
||||
getSheepfoldDict()
|
||||
</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>
|
770
src/views/feed/FormulaManagement/index.vue
Normal file
770
src/views/feed/FormulaManagement/index.vue
Normal file
@ -0,0 +1,770 @@
|
||||
<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="原料" align="center">
|
||||
<el-table-column label="名称" prop="materialName" align="center"/>
|
||||
<el-table-column label="类型" align="center" prop="isGranular">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="material_type" :value="scope.row.isGranular" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="比例" align="center" prop="ratio" />
|
||||
<el-table-column label="类型" prop="isSupplement" align="center">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="materialType" :value="scope.row.isSupplement" />
|
||||
</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" align="center">
|
||||
<el-table-column label="名称" align="center">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.materialId" filterable placeholder="请选择原料" style="width: 100%"
|
||||
@change="handleMaterialChange(scope.row, $event)">
|
||||
<el-option-group v-for="group in groupedMaterials" :key="group.label" :label="group.label">
|
||||
<el-option v-for="item in group.options" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" align="center" prop="isGranular">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="material_type" :value="scope.row.isGranular" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="比例" prop="dosage" align="center">
|
||||
<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="isSupplement" align="center">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.isSupplement" 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 { material_type } = proxy.useDict('material_type')
|
||||
console.log("material_type: ", material_type);
|
||||
const useStaus = [
|
||||
{ value: '1', label: '启用' },
|
||||
{ value: '0', label: '停用' }
|
||||
]
|
||||
const checkedSwPresDetail = ref([]) // 子表选中的行序号数组
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
feedStage: null,
|
||||
batchId: null,
|
||||
},
|
||||
rules: {
|
||||
formulaId: [
|
||||
{ required: true, message: "配方编号不能为空", trigger: "blur" }
|
||||
],
|
||||
feedStage: [
|
||||
{ required: true, message: "饲养阶段不能为空", trigger: "blur" }
|
||||
],
|
||||
ratio: [
|
||||
{ required: true, message: "比例不能为空", trigger: "blur" },
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
|
||||
const formulaForm = ref({
|
||||
materialId: '',
|
||||
materialName: '',
|
||||
ratio: '',
|
||||
isGranular: false
|
||||
})
|
||||
const formulaListOpen = ref(false)
|
||||
/** 查询配方管理列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listFormulaManagement(queryParams.value).then(response => {
|
||||
FormulaManagementList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
console.log("配方管理列表数据:", FormulaManagementList.value)
|
||||
})
|
||||
}
|
||||
|
||||
// 处理展开行的变化
|
||||
function handleExpandChange(row, expandedRows) {
|
||||
// 收起其他行
|
||||
expandedRows.forEach(r => {
|
||||
if (r !== row) {
|
||||
mainTable.value.toggleRowExpansion(r, false)
|
||||
}
|
||||
})
|
||||
|
||||
// 如果是展开状态,刷新子表数据
|
||||
const isExpanded = expandedRows.includes(row)
|
||||
if (isExpanded) {
|
||||
loading.value = true
|
||||
getList();
|
||||
}
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
formulaListOpen.value = false
|
||||
formulaFormReset()
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
formulaId: null,
|
||||
feedStage: null,
|
||||
batchId: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("FormulaManagementRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.formulaId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAddFormulatemplate() {
|
||||
formulaFormReset()
|
||||
reset()
|
||||
operationType.value = "add"
|
||||
// 模板禁用批号编辑
|
||||
BatchIdEditable.value = false
|
||||
// 添加模板时配方编号可编辑
|
||||
FormulaIdEditable.value = true
|
||||
isView.value = false
|
||||
// 初始化表单
|
||||
showFormulaManagementList.value = {
|
||||
formulaId: null,
|
||||
// 模板批号为 0
|
||||
batchId: "0",
|
||||
feedStage: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: '1', // 默认启用
|
||||
remark: null,
|
||||
sgFormulaList: [{
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
}]
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "添加配方管理模板"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleFormulaTemplateUpdate(row) {
|
||||
reset()
|
||||
operationType.value = "update"
|
||||
const _id = row.formulaId || ids.value
|
||||
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||
FormulaIdEditable.value = false // 修改时配方编号不可编辑
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "修改处方"
|
||||
isView.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.formulaId != null) {
|
||||
updateFormulaManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addFormulaManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _formulaIds = row.formulaId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除配方管理编号为"' + _formulaIds + '"的数据项?').then(function () {
|
||||
return delFormulaManagement(_formulaIds)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** ================= 配方列表操作 ================= */
|
||||
function handleAddSgFormulaList(row) {
|
||||
formulaFormReset()
|
||||
reset()
|
||||
operationType.value = "add"
|
||||
BatchIdEditable.value = true
|
||||
FormulaIdEditable.value = false
|
||||
isView.value = false
|
||||
console.log(row.sgFormulaList)
|
||||
// 初始化表单
|
||||
showFormulaManagementList.value = {
|
||||
formulaId: row.formulaId || null,
|
||||
batchId: null,
|
||||
feedStage: null,
|
||||
useStartDate: null,
|
||||
useEndDate: null,
|
||||
useState: '1', // 默认启用
|
||||
remark: null,
|
||||
sgFormulaList: row.sgFormulaList || [{
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
}]
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "添加配方"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleFormulaUpdate(row) {
|
||||
formulaFormReset()
|
||||
const _code = row.code || ids.value
|
||||
getFormulaList(_code).then(response => {
|
||||
formulaForm.value = response.data
|
||||
if (formulaForm.value.isGranular === "1") {
|
||||
formulaForm.value.isGranular = true
|
||||
} else {
|
||||
formulaForm.value.isGranular = false
|
||||
}
|
||||
console.log("formulaForm: ", formulaForm.value)
|
||||
formulaListOpen.value = true
|
||||
FormulaIdEditable.value = false
|
||||
title.value = "修改配方列表"
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleFormulaDelete(row) {
|
||||
const _codes = row.formulaId + "/" + row.batchId
|
||||
proxy.$modal.confirm('是否确认删除配方列表编号为"' + _codes + '"的数据项?').then(function () {
|
||||
return delFormulaManagement(_codes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitFormulaListForm() {
|
||||
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (showFormulaManagementList.value.formulaId != null && operationType.value === "update") {
|
||||
updateFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
formulaListOpen.value = false
|
||||
getList()
|
||||
})
|
||||
} else if (operationType.value === "add" && showFormulaManagementList.value.formulaId != null && showFormulaManagementList.value.batchId != null) {
|
||||
addFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
formulaListOpen.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 原料下拉选择变化时,更新对应的原料名称
|
||||
function handleMaterialChange(row, selectedValue) {
|
||||
const selectedItem = this.materials.find(item => item.value === selectedValue);
|
||||
if (selectedItem) {
|
||||
// materialName 也在 row 中
|
||||
row.materialName = selectedItem.label;
|
||||
row.isGranular = selectedItem.isGranular; // 更新 isGranular
|
||||
row.isSupplement = selectedItem.isSupplement; // 更新 isSupplement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
* 根据 id 拉取单条记录及子表数据,弹窗只读展示
|
||||
*/
|
||||
function handleView(row) {
|
||||
reset()
|
||||
const _id = row.formulaId || ids.value
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
title.value = "配方详情"
|
||||
isView.value = true
|
||||
formulaListOpen.value = true
|
||||
console.log("handleView showFormulaManagementList: ", showFormulaManagementList.value);
|
||||
console.log("handleView response: ", response);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改按钮
|
||||
* 与查看详情共用接口,但弹窗可编辑
|
||||
*/
|
||||
function handleFormulaDetailUpdate(row) {
|
||||
reset()
|
||||
operationType.value = "update"
|
||||
const _id = row.formulaId || ids.value
|
||||
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||
const batchId = row.batchId
|
||||
const queryParams = {
|
||||
formulaId: _id,
|
||||
batchId: batchId,
|
||||
queryType: "query"
|
||||
}
|
||||
listFormulaManagement(queryParams).then(response => {
|
||||
if (response.rows && response.rows.length > 0) {
|
||||
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||
} else {
|
||||
showFormulaManagementList.value = {}
|
||||
}
|
||||
formulaListOpen.value = true
|
||||
title.value = "修改配方"
|
||||
isView.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 添加项
|
||||
function handleAddSgFormulaListDetail() {
|
||||
showFormulaManagementList.value.sgFormulaList.push({
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: "0",
|
||||
isSupplement: "0"
|
||||
})
|
||||
}
|
||||
// 删除项
|
||||
function deleteFormulaListDetail(row) {
|
||||
const index = showFormulaManagementList.value.sgFormulaList.findIndex(item => item.index === row.index)
|
||||
if (index !== -1) {
|
||||
showFormulaManagementList.value.sgFormulaList.splice(index, 1)
|
||||
}
|
||||
}
|
||||
// 表单重置
|
||||
function formulaFormReset() {
|
||||
form.value = {
|
||||
code: null,
|
||||
formulaId: null,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
ratio: null,
|
||||
isGranular: null,
|
||||
isSupplement: null
|
||||
}
|
||||
proxy.resetForm("FormulaListRef")
|
||||
}
|
||||
|
||||
// 原料列表查询参数
|
||||
const materialQueryParams = ref({
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
isGranular: null
|
||||
})
|
||||
function getMaterials() {
|
||||
listMaterial(materialQueryParams).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
materials.value = response.rows.map(item => ({
|
||||
value: item.materialId,
|
||||
label: item.materialName,
|
||||
isGranular: item.isGranular,
|
||||
isSupplement: "0" // 默认补饲原料为 0
|
||||
}))
|
||||
console.log("原料列表:", materials.value)
|
||||
})
|
||||
}
|
||||
|
||||
/** ================== 分组下拉列表部分 ======================== */
|
||||
const groupedMaterials = ref([]) // 存储分组后的原料数据
|
||||
|
||||
// 从后端获取数据并按isGranular分组
|
||||
function getGroupMaterials() {
|
||||
listMaterial(materialQueryParams).then(response => {
|
||||
console.log("获取原料列表:", response)
|
||||
|
||||
// 根据material_type分组数据
|
||||
const groups = material_type.value.map(type => ({
|
||||
label: type.label,
|
||||
options: []
|
||||
}))
|
||||
|
||||
// 遍历原料数据,根据isGranular字段分组
|
||||
response.rows.forEach(item => {
|
||||
const group = groups.find(group => group.label === material_type.value.find(type => type.value === item.isGranular).label)
|
||||
group.options.push({
|
||||
value: item.materialId,
|
||||
label: item.materialName
|
||||
})
|
||||
})
|
||||
|
||||
// 将分组后的数据赋值给groupedMaterials
|
||||
groupedMaterials.value = groups
|
||||
console.log("分组后的原料列表:", groupedMaterials.value)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 子表多选回调
|
||||
* 记录被选中的行序号数组
|
||||
*/
|
||||
function handleSgFormulaListDetailSelectionChange(selection) {
|
||||
checkedSwPresDetail.value = selection.map(item => item.index)
|
||||
}
|
||||
/**
|
||||
* 子表行序号计算
|
||||
* 通过 el-table 的 row-class-name 钩子给每一行写入 index(从 1 开始)
|
||||
*/
|
||||
function rowSgFormulaListDetailIndex({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1
|
||||
}
|
||||
|
||||
/** ================================= */
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('feed/FormulaManagement/export', {
|
||||
...queryParams.value
|
||||
}, `FormulaManagement_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
// 初始化加载数据
|
||||
getList()
|
||||
// 加载原料列表
|
||||
getMaterials()
|
||||
// 加载分组原料列表
|
||||
getGroupMaterials()
|
||||
</script>
|
@ -8,6 +8,25 @@
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepfoldId">
|
||||
<el-select v-model="queryParams.sheepfoldId" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||
</el-select>
|
||||
</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-date-picker v-model="daterangeMeasureDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊只类别" prop="sheepTypeId">
|
||||
<el-select v-model="queryParams.sheepTypeId" placeholder="请选择羊只类别" clearable style="min-width:150px">
|
||||
<el-option v-for="type in sheepTypeList" :key="type.id" :label="type.name" :value="type.id" />
|
||||
</el-select>
|
||||
</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-date-picker>
|
||||
@ -43,6 +62,24 @@
|
||||
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
||||
<!-- <el-table-column label="羊只id" align="center" prop="sheepId" /> -->
|
||||
<el-table-column label="管理耳号" align="center" prop="manageTags" fixed min-width="100px" />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" min-width="100px" />
|
||||
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||
<el-table-column label="事件类型" align="center" prop="eventType" width="120" />
|
||||
<el-table-column label="测量日期" align="center" prop="measureDate" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.measureDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="羊只类别" align="center" prop="sheepTypeName" />
|
||||
<el-table-column label="性别" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ genderMap[scope.row.gender] || '未知' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="胎次" align="center" prop="parity" />
|
||||
<el-table-column label="出生体重(kg)" align="center" prop="birthWeight" min-width="100px" />
|
||||
<el-table-column label="断奶体重(kg)" align="center" prop="weaningWeight" min-width="100px" />
|
||||
<el-table-column label="当前体重(kg)" align="center" prop="currentWeight" min-width="100px" />
|
||||
<el-table-column label="体高" align="center" prop="height" />
|
||||
<el-table-column label="胸围" align="center" prop="bust" />
|
||||
<el-table-column label="体斜长" align="center" prop="bodyLength" />
|
||||
@ -53,6 +90,30 @@
|
||||
<el-table-column label="尻高" align="center" prop="rumpHeignt" />
|
||||
<el-table-column label="腰角宽" align="center" prop="hipWidth" />
|
||||
<el-table-column label="十字部高" align="center" prop="hipCrossHeight" />
|
||||
|
||||
<el-table-column label="繁育状态" align="center" prop="breedStatusName" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.breedStatusName || '未设置' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="泌乳天数" align="center" prop="lactationDay" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.lactationDay || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="怀孕天数" align="center" prop="gestationDay" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.gestationDay || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="配后天数" align="center" prop="postMatingDay" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.postMatingDay || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="comment" min-width="100px" />
|
||||
<el-table-column label="技术员" align="center" prop="technician" />
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
@ -84,7 +145,10 @@
|
||||
<el-input v-model="form.manageTags" placeholder="请输入管理耳号" @blur="onManageTagsBlur" :disabled="!isAdd"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="测量日期" prop="measureDate">
|
||||
<el-date-picker v-model="form.measureDate" value-format="YYYY-MM-DD" type="date" placeholder="请选择测量日期"
|
||||
:disabled="!isAdd"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="体高" prop="height">
|
||||
<el-input v-model="form.height" placeholder="请输入体高" :disabled="!isAdd" clearable />
|
||||
</el-form-item>
|
||||
@ -149,10 +213,11 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Body_measure">
|
||||
import { listBody_measure, getBody_measure, delBody_measure, addBody_measure, updateBody_measure } from "@/api/produce/bodyManage/body_measure"
|
||||
import { getCurrentInstance } from 'vue'
|
||||
import { listBody_measure, getBody_measure, delBody_measure, addBody_measure, updateBody_measure, getSheepTypeList } from "@/api/produce/bodyManage/body_measure"
|
||||
import { getSheepByManageTags } from "@/api/produce/manage_sheep/changeVariety"
|
||||
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { getVarietyOptions } from '@/api/produce/other/fixHoof'
|
||||
import { getCurrentInstance } from 'vue'
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const body_measureList = ref([])
|
||||
@ -166,6 +231,13 @@ const total = ref(0)
|
||||
const title = ref("")
|
||||
const daterangeCreateTime = ref([])
|
||||
const isAdd = ref(false)
|
||||
const daterangeMeasureDate = ref([]);
|
||||
|
||||
const genderMap = {
|
||||
1: '母',
|
||||
2: '公',
|
||||
3: '阉羊'
|
||||
};
|
||||
|
||||
const data = reactive({
|
||||
form: { manageTags: null, technician: null },
|
||||
@ -173,7 +245,10 @@ const data = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sheepId: null,
|
||||
sheepfoldId: null,
|
||||
varietyId: null,
|
||||
manageTags: null,
|
||||
measureDate: null,
|
||||
createTime: null
|
||||
},
|
||||
rules: {
|
||||
@ -183,7 +258,12 @@ const data = reactive({
|
||||
technician: [
|
||||
{ required: true, message: '请输入技术员', trigger: 'blur' }
|
||||
],
|
||||
}
|
||||
measureDate: [
|
||||
{ required: true, message: '请选择测量日期', trigger: 'change' }
|
||||
]
|
||||
},
|
||||
sheepfoldName: '',
|
||||
varietyName: '',
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
@ -196,6 +276,10 @@ function getList() {
|
||||
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
||||
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
||||
}
|
||||
if (daterangeMeasureDate.value.length > 0) {
|
||||
queryParams.value.params["beginMeasureDate"] = daterangeMeasureDate.value[0];
|
||||
queryParams.value.params["endMeasureDate"] = daterangeMeasureDate.value[1];
|
||||
}
|
||||
listBody_measure(queryParams.value).then(response => {
|
||||
body_measureList.value = response.rows
|
||||
total.value = response.total
|
||||
@ -252,6 +336,7 @@ function reset() {
|
||||
comment: null,
|
||||
technician: null,
|
||||
createBy: null,
|
||||
measureDate: null,
|
||||
createTime: null
|
||||
}
|
||||
proxy.resetForm("body_measureRef")
|
||||
@ -265,9 +350,14 @@ function handleQuery() {
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
daterangeCreateTime.value = [];
|
||||
queryParams.value.sheepfoldId = null;
|
||||
data.sheepfoldName = '';
|
||||
queryParams.value.varietyId = null;
|
||||
data.varietyName = '';
|
||||
daterangeMeasureDate.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
@ -336,5 +426,36 @@ function handleExport() {
|
||||
}, `body_measure_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
//加载羊舍数据
|
||||
const sheepfoldOptions = ref([])
|
||||
function getSheepfoldOptions() {
|
||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
//加载品种数据
|
||||
const varietyOptions = ref([])
|
||||
function loadVarietyOptions() {
|
||||
getVarietyOptions({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
varietyOptions.value = res.rows;
|
||||
})
|
||||
}
|
||||
|
||||
// 加载羊只类别数据
|
||||
const sheepTypeList = ref([]);
|
||||
function loadSheepTypeList() {
|
||||
getSheepTypeList().then(response => {
|
||||
sheepTypeList.value = response.rows || [];
|
||||
}).catch(error => {
|
||||
console.error('加载羊只类别失败', error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getSheepfoldOptions()
|
||||
loadSheepTypeList()
|
||||
loadVarietyOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
@ -8,6 +8,11 @@
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品种" prop="varietyId">
|
||||
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" clearable style="min-width:150px">
|
||||
<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-date-picker v-model="daterangeDatetime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
@ -17,8 +22,8 @@
|
||||
style="max-width: 150px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepfold">
|
||||
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" clearable filterable @keyup.enter="handleQuery">
|
||||
<el-option v-for="item in sheepfoldList" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||
<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-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="羊舍id" prop="sheepfold">
|
||||
@ -39,10 +44,10 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['body_score:body_score:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['body_score:body_score:edit']">修改</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['body_score:body_score:remove']">删除</el-button>
|
||||
@ -58,27 +63,29 @@
|
||||
<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="管理耳号" align="center" prop="manageTags" fixed />
|
||||
<el-table-column label="事件日期" align="center" prop="datetime" width="180">
|
||||
<el-table-column label="管理耳号" align="center" prop="manageTags" min-width="100px" fixed />
|
||||
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||
<el-table-column label="事件类型" align="center" prop="eventType" />
|
||||
<el-table-column label="事件日期" align="center" prop="datetime" min-width="120px">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="体况评分" align="center" prop="score" />
|
||||
<!-- <el-table-column label="羊舍id" align="center" prop="sheepfold" /> -->
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" />
|
||||
<el-table-column label="备注" align="center" prop="comment" />
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" min-width="100px" />
|
||||
<el-table-column label="备注" align="center" prop="comment" min-width="130px" />
|
||||
<el-table-column label="技术员" align="center" prop="technician" />
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" min-width="130px">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="150px">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="150px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['body_score:body_score:edit']">修改</el-button>
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['body_score:body_score:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['body_score:body_score:remove']">删除</el-button>
|
||||
</template>
|
||||
@ -133,8 +140,8 @@
|
||||
|
||||
<script setup name="Body_score">
|
||||
import { listBody_score, getBody_score, delBody_score, addBody_score, updateBody_score } from "@/api/produce/bodyManage/body_score"
|
||||
import { listSheepfold } from "@/api/produce/manage_sheep/trans_group"
|
||||
import { checkSheepByManageTags } from "@/api/produce/other/fixHoof"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { checkSheepByManageTags, getVarietyOptions } from "@/api/produce/other/fixHoof"
|
||||
import { getCurrentInstance, ref, reactive, toRefs } from 'vue'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@ -167,6 +174,8 @@ const data = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
manageTags: null,
|
||||
varietyId: null,
|
||||
sheepfold: null,
|
||||
score: null,
|
||||
createTime: null
|
||||
},
|
||||
@ -234,14 +243,12 @@ function onManageTagsBlur() {
|
||||
});
|
||||
}
|
||||
|
||||
// 加载羊舍列表
|
||||
function loadSheepfoldList() {
|
||||
listSheepfold().then(response => {
|
||||
sheepfoldList.value = response.rows || [];
|
||||
}).catch(err => {
|
||||
console.error("加载羊舍列表失败:", err);
|
||||
proxy.$modal.msgError("加载羊舍列表失败,请刷新页面重试");
|
||||
});
|
||||
//加载羊舍数据
|
||||
const sheepfoldOptions = ref([])
|
||||
function getSheepfoldOptions() {
|
||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
@ -276,6 +283,7 @@ function handleQuery() {
|
||||
function resetQuery() {
|
||||
daterangeDatetime.value = []
|
||||
daterangeCreateTime.value = []
|
||||
queryParams.value.varietyId = null;
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@ -350,6 +358,17 @@ function handleExport() {
|
||||
}, `body_score_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
loadSheepfoldList();
|
||||
//加载品种数据
|
||||
const varietyOptions = ref([])
|
||||
function loadVarietyOptions() {
|
||||
getVarietyOptions({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
varietyOptions.value = res.rows;
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadVarietyOptions()
|
||||
getSheepfoldOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
@ -8,6 +8,20 @@
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入耳号搜索" clearable @keyup.enter="handleQuery"
|
||||
style="max-width: 160px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品种" prop="varietyId">
|
||||
<el-select v-model="queryParams.varietyId" placeholder="请选择品种" clearable style="min-width:150px">
|
||||
<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-date-picker v-model="daterangeEventDate" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="羊舍" prop="sheepfoldId">
|
||||
<el-select v-model="queryParams.sheepfoldId" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||
</el-select>
|
||||
</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-date-picker>
|
||||
@ -23,10 +37,10 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['breast_rating:breast_rating:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['breast_rating:breast_rating:edit']">修改</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['breast_rating:breast_rating:remove']">删除</el-button>
|
||||
@ -42,25 +56,33 @@
|
||||
<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="管理耳号" align="center" prop="manageTags" />
|
||||
<el-table-column label="管理耳号" align="center" prop="manageTags" min-width="100px" fixed />
|
||||
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||
<el-table-column label="事件类型" align="center" prop="eventType" />
|
||||
<el-table-column label="事件日期" align="center" prop="eventDate" min-width="120px">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.eventDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="羊舍" align="center" prop="sheepfoldName" min-width="120px" />
|
||||
<el-table-column label="乳房深度" align="center" prop="depth" />
|
||||
<el-table-column label="乳房长度" align="center" prop="length" />
|
||||
<el-table-column label="乳房位置" align="center" prop="position" />
|
||||
<el-table-column label="乳房附着" align="center" prop="adbere" />
|
||||
<el-table-column label="乳房间隔度" align="center" prop="spacing" />
|
||||
<el-table-column label="乳房间隔度" align="center" prop="spacing" min-width="120px" />
|
||||
<el-table-column label="乳房评分" align="center" prop="score" />
|
||||
<el-table-column label="备注" align="center" prop="comment" />
|
||||
<el-table-column label="技术员" align="center" prop="technician" />
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="150">
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" min-width="150">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="120px">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="120px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['breast_rating:breast_rating:edit']">修改</el-button>
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['breast_rating:breast_rating:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['breast_rating:breast_rating:remove']">删除</el-button>
|
||||
</template>
|
||||
@ -80,6 +102,11 @@
|
||||
<el-input v-model="form.manageTags" placeholder="请输入管理耳号" @blur="onManageTagsBlur" clearable
|
||||
:disabled="!isAdd" />
|
||||
</el-form-item>
|
||||
<el-form-item label="事件日期" prop="eventDate">
|
||||
<el-date-picker clearable v-model="form.eventDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择事件日期"
|
||||
:disabled="!isAdd">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="乳房深度" prop="depth">
|
||||
<el-input v-model="form.depth" placeholder="请输入乳房深度" :disabled="!isAdd" />
|
||||
</el-form-item>
|
||||
@ -117,7 +144,8 @@
|
||||
|
||||
<script setup name="Breast_rating">
|
||||
import { listBreast_rating, getBreast_rating, delBreast_rating, addBreast_rating, updateBreast_rating } from "@/api/produce/bodyManage/breast_rating"
|
||||
import { checkSheepByManageTags } from "@/api/produce/other/fixHoof"
|
||||
import { checkSheepByManageTags, getVarietyOptions } from "@/api/produce/other/fixHoof"
|
||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||
import { getCurrentInstance, reactive, ref } from "vue"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
@ -132,11 +160,13 @@ const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const daterangeCreateTime = ref([])
|
||||
const daterangeEventDate = ref([]);
|
||||
const isAdd = ref(false)
|
||||
const data = reactive({
|
||||
form: {
|
||||
id: null,
|
||||
manageTags: null,
|
||||
eventDate: null,
|
||||
depth: null,
|
||||
length: null,
|
||||
position: null,
|
||||
@ -170,6 +200,10 @@ const { queryParams, form, rules } = toRefs(data)
|
||||
function getList() {
|
||||
loading.value = true
|
||||
queryParams.value.params = {}
|
||||
if (daterangeEventDate.value.length) {
|
||||
queryParams.value.params["beginEventDate"] = daterangeEventDate.value[0]
|
||||
queryParams.value.params["endEventDate"] = daterangeEventDate.value[1]
|
||||
}
|
||||
if (daterangeCreateTime.value.length) {
|
||||
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
||||
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
||||
@ -241,6 +275,7 @@ function handleQuery() {
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
daterangeCreateTime.value = []
|
||||
daterangeEventDate.value = [];
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
@ -315,5 +350,25 @@ function handleExport() {
|
||||
}, `breast_rating_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
//加载羊舍数据
|
||||
const sheepfoldOptions = ref([])
|
||||
function getSheepfoldOptions() {
|
||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
sheepfoldOptions.value = res.rows
|
||||
})
|
||||
}
|
||||
|
||||
//加载品种数据
|
||||
const varietyOptions = ref([])
|
||||
function loadVarietyOptions() {
|
||||
getVarietyOptions({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
varietyOptions.value = res.rows;
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadVarietyOptions()
|
||||
getSheepfoldOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
@ -36,10 +36,10 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['changeComment:changeComment:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['changeComment:changeComment:edit']">修改</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['changeComment:changeComment:remove']">删除</el-button>
|
||||
@ -66,8 +66,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['changeComment:changeComment:edit']">修改</el-button>
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['changeComment:changeComment:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['changeComment:changeComment:remove']">删除</el-button>
|
||||
</template>
|
||||
@ -90,7 +90,7 @@
|
||||
<el-input v-model="form.newComment" placeholder="请输入新备注" :disabled="!isAddMode" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原备注" prop="oldComment">
|
||||
<el-input v-model="form.oldComment" placeholder="请输入原备注" :disabled="!isAddMode" />
|
||||
<el-input v-model="form.oldComment" placeholder="请输入原备注" disabled />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -31,10 +31,10 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['changeEar:changeEar:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['changeEar:changeEar:edit']">修改</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['changeEar:changeEar:remove']">删除</el-button>
|
||||
@ -67,8 +67,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['changeEar:changeEar:edit']">修改</el-button>
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['changeEar:changeEar:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['changeEar:changeEar:remove']">删除</el-button>
|
||||
</template>
|
||||
@ -98,7 +98,7 @@
|
||||
<el-input v-model="form.newTag" placeholder="请输入新耳号/电子耳号" @blur="checkNewTagExists" :disabled="!isAddMode" />
|
||||
</el-form-item>
|
||||
<el-form-item label="旧耳号" prop="oldTag">
|
||||
<el-input v-model="form.oldTag" placeholder="请输入旧耳号/电子耳号" :disabled="!isAddMode" />
|
||||
<el-input v-model="form.oldTag" placeholder="请输入旧耳号/电子耳号" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="comment" v-if="!isAddMode">
|
||||
<el-input v-model="form.comment" type="textarea" placeholder="请输入内容" :disabled="!isAddMode" />
|
||||
@ -115,7 +115,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="ChangeEar">
|
||||
import { listChangeEar, getChangeEar, delChangeEar, addChangeEar, updateChangeEar, getSheepByEarNumber,checkTagExists } from "@/api/produce/manage_sheep/changeEar"
|
||||
import { listChangeEar, getChangeEar, delChangeEar, addChangeEar, updateChangeEar, getSheepByEarNumber, checkTagExists } from "@/api/produce/manage_sheep/changeEar"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
|
@ -38,10 +38,10 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['changeVariety:changeVariety:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['changeVariety:changeVariety:edit']">修改</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['changeVariety:changeVariety:remove']">删除</el-button>
|
||||
@ -69,8 +69,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['changeVariety:changeVariety:edit']">修改</el-button>
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['changeVariety:changeVariety:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['changeVariety:changeVariety:remove']">删除</el-button>
|
||||
</template>
|
||||
@ -90,7 +90,7 @@
|
||||
<el-input v-model="form.manageTags" placeholder="请输入管理耳号" @blur="onManageTagsBlur" :disabled="!isAdd" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原品种" prop="varietyOld">
|
||||
<el-input v-model="form.varietyOld" placeholder="请输入原品种" :disabled="!isAdd" />
|
||||
<el-input v-model="form.varietyOld" placeholder="请输入原品种" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="新品种" prop="varietyNew">
|
||||
<el-select v-model="form.varietyNew" placeholder="请选择新品种" clearable filterable :disabled="!isAdd">
|
||||
|
@ -102,14 +102,12 @@
|
||||
:value="sheep.manageTags" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 在el-form中新增牧场选择项 -->
|
||||
<el-form-item label="牧场" prop="ranchId">
|
||||
<el-select v-model="form.ranchId" placeholder="请选择牧场" clearable @change="handleRanchChange">
|
||||
<el-option v-for="ranch in ranchOptions" :key="ranch.id" :label="ranch.ranchName" :value="ranch.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 调整转出羊舍的options为当前牧场的羊舍 -->
|
||||
<el-form-item label="转出羊舍" prop="foldFrom">
|
||||
<el-select v-model="form.foldFrom" placeholder="请选择转出羊舍" clearable :disabled="!form.ranchId"
|
||||
@change="handleSheepFilter">
|
||||
@ -118,7 +116,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 调整转入羊舍的options为当前牧场的羊舍 -->
|
||||
<el-form-item label="转入羊舍" prop="foldTo">
|
||||
<el-select v-model="form.foldTo" placeholder="请选择转入羊舍" clearable :disabled="!form.ranchId">
|
||||
<el-option v-for="fold in currentRanchSheepfolds" :key="fold.id" :label="fold.sheepfoldName"
|
||||
|
@ -3,7 +3,8 @@
|
||||
<!-- 搜索区域 -->
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery" style="width: 150px;"/>
|
||||
<el-input v-model="queryParams.manageTags" placeholder="请输入管理耳号" clearable @keyup.enter="handleQuery"
|
||||
style="width: 150px;" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="羊舍" prop="sheepfold">
|
||||
@ -60,7 +61,7 @@
|
||||
<el-table-column label="品种" align="center" prop="varietyName" />
|
||||
<el-table-column label="备注" align="center" prop="comment" />
|
||||
<el-table-column label="技术员" align="center" prop="technician" />
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
@ -85,7 +86,7 @@
|
||||
<el-form ref="castrateRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="管理耳号" prop="manageTags">
|
||||
<el-select v-model="form.manageTags" placeholder="请输入或选择耳号" multiple filterable allow-create
|
||||
style="width: 100%" @change="loadSheepInfo" @blur="loadSheepInfo">
|
||||
style="width: 100%" @change="loadSheepInfo" @blur="loadSheepInfo">
|
||||
<el-option v-for="sheep in sheepOptions" :key="sheep.id" :label="sheep.manageTags"
|
||||
:value="sheep.manageTags" />
|
||||
</el-select>
|
||||
@ -154,9 +155,9 @@ const data = reactive({
|
||||
manageTags: [
|
||||
{ required: true, message: '请输入管理耳号', trigger: 'blur' }
|
||||
],
|
||||
sheepfold: [
|
||||
{ required: true, message: '请选择羊舍', trigger: 'change' }
|
||||
],
|
||||
// sheepfold: [
|
||||
// { required: true, message: '请选择羊舍', trigger: 'change' }
|
||||
// ],
|
||||
technician: [
|
||||
{ required: true, message: '请输入技术员', trigger: 'blur' }
|
||||
]
|
||||
@ -186,7 +187,7 @@ function loadSheepBySheepfold() {
|
||||
sheepOptions.value = sheepList.map(sheep => ({
|
||||
id: sheep.id,
|
||||
manageTags: sheep.manageTags,
|
||||
gender: sheep.gender
|
||||
gender: sheep.gender
|
||||
}));
|
||||
})
|
||||
.catch(error => {
|
||||
@ -207,18 +208,18 @@ async function loadSheepInfo() {
|
||||
for (const tag of tags) {
|
||||
try {
|
||||
const { data: sheepData } = await checkSheepByManageTags(tag.trim());
|
||||
|
||||
|
||||
if (!sheepData) {
|
||||
validResults.push(false);
|
||||
proxy.$modal.msgError(`耳号 ${tag} 不存在`);
|
||||
} else if (sheepData.gender !== 2) {
|
||||
} else if (sheepData.gender !== 2) {
|
||||
validResults.push(false);
|
||||
proxy.$modal.msgError(`耳号 ${tag} 对应的羊只性别不是公,无法添加`);
|
||||
} else {
|
||||
validResults.push(true);
|
||||
tagDetails[tag] = {
|
||||
sheepId: sheepData.id,
|
||||
gender: sheepData.gender,
|
||||
gender: sheepData.gender,
|
||||
sheepfoldId: sheepData.sheepfoldId,
|
||||
varietyId: sheepData.varietyId,
|
||||
comment: sheepData.comment || ''
|
||||
@ -261,7 +262,7 @@ function getList() {
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
getVarietyOptions({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
getVarietyOptions({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||
varietyOptions.value = res.rows || []
|
||||
})
|
||||
}
|
||||
@ -426,8 +427,8 @@ function getSheepfoldOptions() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
getSheepfoldOptions()
|
||||
getVarietyOptions()
|
||||
getList()
|
||||
})
|
||||
</script>
|
@ -219,9 +219,9 @@ async function loadSheepInfo() {
|
||||
form.value.tagDetails = tagDetails;
|
||||
|
||||
if (validTags.length > 0) {
|
||||
const firstValidTag = validTags[0]; 耳号
|
||||
const firstValidTag = validTags[0];
|
||||
const firstSheepfoldId = tagDetails[firstValidTag].sheepfoldId;
|
||||
form.value.sheepfold = firstSheepfoldId;
|
||||
form.value.sheepfold = firstSheepfoldId;
|
||||
}
|
||||
}
|
||||
|
||||
|
314
src/views/stock/in/index.vue
Normal file
314
src/views/stock/in/index.vue
Normal file
@ -0,0 +1,314 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="单据日期" prop="docDate">
|
||||
<el-input v-model="queryParams.docDate" placeholder="请输入单据日期" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="业务类型" prop="businessType">
|
||||
<el-input v-model="queryParams.businessType" placeholder="请输入业务类型" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库" prop="repositoryName">
|
||||
<el-input v-model="queryParams.repositoryName" 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>
|
||||
<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="['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']" 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']" v-show="false">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['stock:in:export']">导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['stock:in:import']">导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="inList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="stockInCode" />
|
||||
<el-table-column label="单据日期" align="center" prop="docDate" />
|
||||
<el-table-column label="创建时间" align="center" prop="createDate" />
|
||||
<el-table-column label="单据编号" align="center" prop="docId" />
|
||||
<el-table-column label="业务类型" align="center" prop="businessType" />
|
||||
<el-table-column label="仓库编码" align="center" prop="repositoryId" />
|
||||
<el-table-column label="仓库" align="center" prop="repositoryName" />
|
||||
<el-table-column label="入库类别" align="center" prop="stockInType" />
|
||||
<el-table-column label="供应商编码" align="center" prop="supplierId" />
|
||||
<el-table-column label="供应商" align="center" prop="supplierName" />
|
||||
<el-table-column label="部门编码" align="center" prop="departmentId" />
|
||||
<el-table-column label="部门" align="center" prop="departmentName" />
|
||||
<el-table-column label="经手人编码" align="center" prop="operatorId" />
|
||||
<el-table-column label="经手人" align="center" prop="operatorName" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="制单人" align="center" prop="single" />
|
||||
<el-table-column label="审核人" align="center" prop="reviewer" />
|
||||
<el-table-column label="存货编码" align="center" prop="materialId" />
|
||||
<el-table-column label="存货" align="center" prop="materialName" />
|
||||
<el-table-column label="规格型号" align="center" prop="materialSpecification" />
|
||||
<el-table-column label="计量单位" align="center" prop="materialUnit" />
|
||||
<el-table-column label="实收数量" align="center" prop="count" />
|
||||
<el-table-column label="入库调整" align="center" prop="stockInAdjustRemark" />
|
||||
<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="['stock:in:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['stock:in: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="inRef" :model="form" :rules="rules" label-width="80px">
|
||||
</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="upload.title" v-model="upload.open" width="400px" append-to-body>
|
||||
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
||||
@click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<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([])
|
||||
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,
|
||||
docDate: null,
|
||||
businessType: null,
|
||||
repositoryName: null,
|
||||
materialName: null,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
})
|
||||
|
||||
/*** 用户导入参数 */
|
||||
const upload = reactive({
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + "/stock/in/importData"
|
||||
})
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImport() {
|
||||
upload.title = "入库记录导入"
|
||||
upload.open = true
|
||||
}
|
||||
/** 提交上传文件 */
|
||||
function submitFileForm() {
|
||||
proxy.$refs["uploadRef"].submit()
|
||||
}
|
||||
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
upload.isUploading = true
|
||||
}
|
||||
|
||||
/** 文件上传成功处理 */
|
||||
const handleFileSuccess = (response, file, fileList) => {
|
||||
upload.open = false
|
||||
upload.isUploading = false
|
||||
proxy.$refs["uploadRef"].handleRemove(file)
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
||||
getList()
|
||||
}
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询入库记录列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listIn(queryParams.value).then(response => {
|
||||
inList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
stockInCode: null,
|
||||
docDate: null,
|
||||
createDate: null,
|
||||
docId: null,
|
||||
businessType: null,
|
||||
repositoryId: null,
|
||||
repositoryName: null,
|
||||
stockInType: null,
|
||||
supplierId: null,
|
||||
supplierName: null,
|
||||
departmentId: null,
|
||||
departmentName: null,
|
||||
operatorId: null,
|
||||
operatorName: null,
|
||||
remark: null,
|
||||
single: null,
|
||||
reviewer: null,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
materialSpecification: null,
|
||||
materialUnit: null,
|
||||
count: null,
|
||||
stockInAdjustRemark: null
|
||||
}
|
||||
proxy.resetForm("inRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.stockInCode)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加入库记录"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _stockInCode = row.stockInCode || ids.value
|
||||
getIn(_stockInCode).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改入库记录"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["inRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.stockInCode != null) {
|
||||
updateIn(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addIn(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _stockInCodes = row.stockInCode || ids.value
|
||||
proxy.$modal.confirm('是否确认删除入库记录编号为"' + _stockInCodes + '"的数据项?').then(function () {
|
||||
return delIn(_stockInCodes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('stock/in/export', {
|
||||
...queryParams.value
|
||||
}, `in_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
356
src/views/stock/management/index.vue
Normal file
356
src/views/stock/management/index.vue
Normal file
@ -0,0 +1,356 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<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="productionDate">
|
||||
<el-input
|
||||
v-model="queryParams.productionDate"
|
||||
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="['stock:management:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['stock:management:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['stock:management:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['stock:management:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['stock:management:import']">导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="materialManagementCode" />
|
||||
<el-table-column label="存货编码" align="center" prop="materialId" />
|
||||
<el-table-column label="存货" align="center" prop="materialName" />
|
||||
<el-table-column label="批号" align="center" prop="batchId" />
|
||||
<el-table-column label="规格型号" align="center" prop="materialSpecification" />
|
||||
<el-table-column label="主计量" align="center" prop="materialUnit" />
|
||||
<el-table-column label="现存量(主)" align="center" prop="currentStock" />
|
||||
<el-table-column label="库存预警" align="center" prop="stockAlarm" />
|
||||
<el-table-column label="生产日期" align="center" prop="productionDate" />
|
||||
<el-table-column label="失效日期" align="center" prop="expirationDate" />
|
||||
<el-table-column label="失效预警" align="center" prop="expirationAlarm" />
|
||||
<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="['stock:management:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['stock:management: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="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">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 物资管理记录导入对话框 -->
|
||||
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
||||
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
||||
@click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Management">
|
||||
import { listManagement, getManagement, delManagement, addManagement, updateManagement } from "@/api/stock/management"
|
||||
import { getToken } from "@/utils/auth"
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const managementList = 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,
|
||||
materialName: null,
|
||||
productionDate: null,
|
||||
},
|
||||
rules: {
|
||||
materialId: [
|
||||
{ required: true, message: "存货编码不能为空", trigger: "blur" }
|
||||
],
|
||||
materialName: [
|
||||
{ required: true, message: "存货不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
/*** 用户导入参数 */
|
||||
const upload = reactive({
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + "/stock/management/importData"
|
||||
})
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImport() {
|
||||
upload.title = "物资记录导入"
|
||||
upload.open = true
|
||||
}
|
||||
/** 提交上传文件 */
|
||||
function submitFileForm() {
|
||||
proxy.$refs["uploadRef"].submit()
|
||||
}
|
||||
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
upload.isUploading = true
|
||||
}
|
||||
|
||||
/** 文件上传成功处理 */
|
||||
const handleFileSuccess = (response, file, fileList) => {
|
||||
upload.open = false
|
||||
upload.isUploading = false
|
||||
proxy.$refs["uploadRef"].handleRemove(file)
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
||||
getList()
|
||||
}
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询物资管理列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listManagement(queryParams.value).then(response => {
|
||||
managementList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
materialManagementCode: null,
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
batchId: null,
|
||||
materialSpecification: null,
|
||||
materialUnit: null,
|
||||
currentStock: null,
|
||||
stockAlarm: null,
|
||||
productionDate: null,
|
||||
expirationDate: null,
|
||||
expirationAlarm: null
|
||||
}
|
||||
proxy.resetForm("managementRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.materialManagementCode)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加物资管理"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _materialManagementCode = row.materialManagementCode || ids.value
|
||||
getManagement(_materialManagementCode).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改物资管理"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["managementRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.materialManagementCode != null) {
|
||||
updateManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addManagement(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _materialManagementCodes = row.materialManagementCode || ids.value
|
||||
proxy.$modal.confirm('是否确认删除物资管理编号为"' + _materialManagementCodes + '"的数据项?').then(function() {
|
||||
return delManagement(_materialManagementCodes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('stock/management/export', {
|
||||
...queryParams.value
|
||||
}, `management_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
330
src/views/stock/out/index.vue
Normal file
330
src/views/stock/out/index.vue
Normal file
@ -0,0 +1,330 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="仓库名称" prop="repositoryName">
|
||||
<el-input v-model="queryParams.repositoryName" placeholder="请输入仓库名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目" prop="projectName">
|
||||
<el-input v-model="queryParams.projectName" placeholder="请输入项目" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产车间" prop="departmentName">
|
||||
<el-input v-model="queryParams.departmentName" 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>
|
||||
<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="['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']" 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']" v-show="false">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['stock:out:export']">导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['stock:out:import']">导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="outList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="stockOutCode" />
|
||||
<el-table-column label="单据日期" align="center" prop="docDate" />
|
||||
<el-table-column label="创建时间" align="center" prop="createDate" />
|
||||
<el-table-column label="单据编号" align="center" prop="docId" />
|
||||
<el-table-column label="业务类型" align="center" prop="businessType" />
|
||||
<el-table-column label="仓库编码" align="center" prop="repositoryId" />
|
||||
<el-table-column label="仓库名称" align="center" prop="repositoryName" />
|
||||
<el-table-column label="项目分类" align="center" prop="projectClassification" />
|
||||
<el-table-column label="项目编码" align="center" prop="projectId" />
|
||||
<el-table-column label="项目" align="center" prop="projectName" />
|
||||
<el-table-column label="生产车间编码" align="center" prop="departmentId" />
|
||||
<el-table-column label="生产车间" align="center" prop="departmentName" />
|
||||
<el-table-column label="领用人编码" align="center" prop="receiverId" />
|
||||
<el-table-column label="领用人" align="center" prop="receiver" />
|
||||
<el-table-column label="制单人" align="center" prop="single" />
|
||||
<el-table-column label="审核人" align="center" prop="reviewer" />
|
||||
<el-table-column label="审核时间" align="center" prop="reviewDate" />
|
||||
<el-table-column label="修改人" align="center" prop="modifier" />
|
||||
<el-table-column label="材料分类编码" align="center" prop="materialClassId" />
|
||||
<el-table-column label="材料分类" align="center" prop="materialClassName" />
|
||||
<el-table-column label="材料编码" align="center" prop="materialId" />
|
||||
<el-table-column label="材料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="材料规格" align="center" prop="materialSpecification" />
|
||||
<el-table-column label="计量单位" align="center" prop="materialUnit" />
|
||||
<el-table-column label="数量" align="center" prop="count" />
|
||||
<el-table-column label="批号" align="center" prop="batchId" />
|
||||
<el-table-column label="生产日期" align="center" prop="productionDate" />
|
||||
<el-table-column label="保质期" align="center" prop="shelfLife" />
|
||||
<el-table-column label="保质期单位" align="center" prop="shelfLifeUnit" />
|
||||
<el-table-column label="失效日期" align="center" prop="expirationDate" />
|
||||
<el-table-column label="代理人" align="center" prop="agent" />
|
||||
<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="['stock:out:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['stock:out: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="outRef" :model="form" :rules="rules" label-width="80px">
|
||||
</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="upload.title" v-model="upload.open" width="400px" append-to-body>
|
||||
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
||||
@click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Out">
|
||||
import { listOut, getOut, delOut, addOut, updateOut } from "@/api/stock/out"
|
||||
import { getToken } from "@/utils/auth"
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const outList = 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,
|
||||
businessType: null,
|
||||
repositoryName: null,
|
||||
projectName: null,
|
||||
departmentName: null,
|
||||
materialName: null,
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
})
|
||||
/*** 用户导入参数 */
|
||||
const upload = reactive({
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + "/stock/out/importData"
|
||||
})
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImport() {
|
||||
upload.title = "出库记录导入"
|
||||
upload.open = true
|
||||
}
|
||||
/** 提交上传文件 */
|
||||
function submitFileForm() {
|
||||
proxy.$refs["uploadRef"].submit()
|
||||
}
|
||||
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
upload.isUploading = true
|
||||
}
|
||||
|
||||
/** 文件上传成功处理 */
|
||||
const handleFileSuccess = (response, file, fileList) => {
|
||||
upload.open = false
|
||||
upload.isUploading = false
|
||||
proxy.$refs["uploadRef"].handleRemove(file)
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
||||
getList()
|
||||
}
|
||||
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询出库记录列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listOut(queryParams.value).then(response => {
|
||||
outList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
stockOutCode: null,
|
||||
docDate: null,
|
||||
createDate: null,
|
||||
docId: null,
|
||||
businessType: null,
|
||||
repositoryId: null,
|
||||
repositoryName: null,
|
||||
projectClassification: null,
|
||||
projectId: null,
|
||||
projectName: null,
|
||||
departmentId: null,
|
||||
departmentName: null,
|
||||
receiverId: null,
|
||||
receiver: null,
|
||||
single: null,
|
||||
reviewer: null,
|
||||
reviewDate: null,
|
||||
modifier: null,
|
||||
materialClassId: null,
|
||||
materialId: null,
|
||||
materialClassName: null,
|
||||
materialName: null,
|
||||
materialSpecification: null,
|
||||
materialUnit: null,
|
||||
count: null,
|
||||
batchId: null,
|
||||
productionDate: null,
|
||||
shelfLife: null,
|
||||
shelfLifeUnit: null,
|
||||
expirationDate: null,
|
||||
agent: null
|
||||
}
|
||||
proxy.resetForm("outRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.stockOutCode)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加出库记录"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _stockOutCode = row.stockOutCode || ids.value
|
||||
getOut(_stockOutCode).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改出库记录"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["outRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.stockOutCode != null) {
|
||||
updateOut(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addOut(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _stockOutCodes = row.stockOutCode || ids.value
|
||||
proxy.$modal.confirm('是否确认删除出库记录编号为"' + _stockOutCodes + '"的数据项?').then(function () {
|
||||
return delOut(_stockOutCodes)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('stock/out/export', {
|
||||
...queryParams.value
|
||||
}, `out_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
@ -2,7 +2,7 @@ import path from 'path'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import createVitePlugins from './vite/plugins'
|
||||
|
||||
const baseUrl = 'http://localhost:8080' // 后端接口
|
||||
const baseUrl = 'http://127.0.0.1:8080' // 后端接口
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode, command }) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user