Merge branch 'main' of http://e19510c831.iok.la/admin/zhyc-sheep-ui
This commit is contained in:
commit
a10983b719
60
src/api/Breeding_records/Breeding_records.js
Normal file
60
src/api/Breeding_records/Breeding_records.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询配种记录列表
|
||||||
|
export function listBreeding_records(query) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询配种记录详细
|
||||||
|
export function getBreeding_records(id) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增配种记录
|
||||||
|
export function addBreeding_records(data) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改配种记录
|
||||||
|
export function updateBreeding_records(data) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除配种记录
|
||||||
|
export function delBreeding_records(id) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据耳号查询羊只信息
|
||||||
|
export function getSheepInfoByTags(manageTags) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records/getSheepByTags/' + manageTags,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据母羊耳号获取配种计划信息
|
||||||
|
export function getBreedPlanByEweTags(manageTags) {
|
||||||
|
return request({
|
||||||
|
url: '/Breeding_records/Breeding_records/getBreedPlan/' + manageTags,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
61
src/api/Sperm/Sperm.js
Normal file
61
src/api/Sperm/Sperm.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询采精记录列表
|
||||||
|
export function listSperm(query) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询采精记录详细
|
||||||
|
export function getSperm(id) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增采精记录
|
||||||
|
export function addSperm(data) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改采精记录
|
||||||
|
export function updateSperm(data) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除采精记录
|
||||||
|
export function delSperm(id) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据耳号查询羊只信息
|
||||||
|
export function getSheepByManageTags(manageTags) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm/getSheepByManageTags/' + manageTags,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询羊只耳号列表(用于下拉选择)
|
||||||
|
export function getSheepManageTagsList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/Sperm/Sperm/sheepManageTagsList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
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'
|
||||||
|
})
|
||||||
|
}
|
@ -25,3 +25,25 @@ export function delSheep_file(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 在群总数
|
||||||
|
export const getInGroupCount = () =>
|
||||||
|
request({ url: '/sheep_file/sheep_file/stat/inGroupCount', method: 'get' })
|
||||||
|
|
||||||
|
export function getSheepTypeStat() {
|
||||||
|
return request({ url: '/sheep_file/sheep_file/stat/sheepType', method: 'get' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBreedStatusStat() {
|
||||||
|
return request({ url: '/sheep_file/sheep_file/stat/breedStatus', method: 'get' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getVarietyStat() {
|
||||||
|
return request({ url: '/sheep_file/sheep_file/stat/variety', method: 'get' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLactationParityStat() {
|
||||||
|
return request({ url: '/sheep_file/sheep_file/stat/lactationParity', method: 'get' })
|
||||||
|
}
|
||||||
|
@ -60,3 +60,12 @@ export function approveScTransGroup(data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取所有牧场列表
|
||||||
|
export function listRanch() {
|
||||||
|
return request({
|
||||||
|
url: '/ranch/ranch/list',
|
||||||
|
method: 'get',
|
||||||
|
params: { pageNum: 1, pageSize: 9999 }
|
||||||
|
});
|
||||||
|
}
|
53
src/api/ram_file/breed_ram_file.js
Normal file
53
src/api/ram_file/breed_ram_file.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询种公羊档案列表
|
||||||
|
export function listBreedRamFile(query) {
|
||||||
|
return request({
|
||||||
|
url: '/ram_file/bas_ram_file/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询种公羊档案详细
|
||||||
|
export function getBreedRamFile(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ram_file/bas_ram_file/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增种公羊档案
|
||||||
|
export function addBreedRamFile(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ram_file/bas_ram_file',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改种公羊档案
|
||||||
|
export function updateBreedRamFile(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ram_file/bas_ram_file',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除种公羊档案
|
||||||
|
export function delBreedRamFile(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ram_file/bas_ram_file/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出种公羊档案
|
||||||
|
export function exportBreedRamFile(query) {
|
||||||
|
return request({
|
||||||
|
url: '/ram_file/bas_ram_file/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
52
src/api/sheep_death/death.js
Normal file
52
src/api/sheep_death/death.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询羊只死淘记录列表
|
||||||
|
export function listDeath(query) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询羊只死淘记录详细
|
||||||
|
export function getDeath(id) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据管理耳号查询羊只信息
|
||||||
|
export function getSheepInfo(manageTags) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death/sheepInfo/' + manageTags,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增羊只死淘记录
|
||||||
|
export function addDeath(data) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改羊只死淘记录
|
||||||
|
export function updateDeath(data) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除羊只死淘记录
|
||||||
|
export function delDeath(id) {
|
||||||
|
return request({
|
||||||
|
url: '/sheep_death/death/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
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'
|
||||||
|
})
|
||||||
|
}
|
402
src/views/Breeding_records/Breeding_records/index.vue
Normal file
402
src/views/Breeding_records/Breeding_records/index.vue
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="80px">
|
||||||
|
<el-form-item label="母羊耳号" prop="eweManageTags">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.eweManageTags"
|
||||||
|
placeholder="请输入母羊耳号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公羊耳号" prop="ramManageTags">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.ramManageTags"
|
||||||
|
placeholder="请输入公羊耳号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="母羊品种" prop="eweVariety">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.eweVariety"
|
||||||
|
placeholder="请输入母羊品种"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公羊品种" prop="ramVariety">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.ramVariety"
|
||||||
|
placeholder="请输入公羊品种"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.technician"
|
||||||
|
placeholder="请输入技术员"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建人" prop="createBy">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.createBy"
|
||||||
|
placeholder="请输入创建人"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建日期" prop="createTime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择创建日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['Breeding_records:Breeding_records:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['Breeding_records:Breeding_records:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['Breeding_records:Breeding_records:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['Breeding_records:Breeding_records:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="Breeding_recordsList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="耳号" align="center" prop="eweManageTags" width="120" />
|
||||||
|
<el-table-column label="品种" align="center" prop="eweVariety" width="100" />
|
||||||
|
<el-table-column label="事件类型" align="center" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>配种</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="配种公羊" align="center" prop="ramManageTags" width="120" />
|
||||||
|
<el-table-column label="配种公羊品种" align="center" prop="ramVariety" width="120" />
|
||||||
|
<el-table-column label="配种方式" align="center" prop="matingType" width="100" />
|
||||||
|
<el-table-column label="月龄" align="center" prop="eweMonthAge" width="80" />
|
||||||
|
<el-table-column label="配种时羊只类别" align="center" prop="sheepType" width="120" />
|
||||||
|
<el-table-column label="胎次" align="center" prop="eweParity" width="80" />
|
||||||
|
<el-table-column label="配次" align="center" prop="matingCount" width="80" />
|
||||||
|
<el-table-column label="发情后配种时间(小时)" align="center" prop="timeSincePlanning" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.timeSincePlanning || 0 }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="当前羊舍" align="center" prop="eweSheepfoldName" width="120" />
|
||||||
|
<el-table-column label="技术员" align="center" prop="technician" width="100" />
|
||||||
|
<el-table-column label="羊只备注" align="center" prop="eweComment" width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column label="繁育状态" align="center" prop="eweBreedStatus" width="100" />
|
||||||
|
<el-table-column label="是否性控" align="center" prop="eweControlled" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="scope.row.eweControlled === 1 ? 'success' : 'info'">
|
||||||
|
{{ scope.row.eweControlled === 1 ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="耗精量" align="center" prop="breedDrugs" width="100" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" width="100" />
|
||||||
|
<el-table-column label="创建日期" align="center" prop="createTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="所在牧场" align="center" prop="ranchName" width="120" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['Breeding_records:Breeding_records:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['Breeding_records:Breeding_records: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="600px" append-to-body>
|
||||||
|
<el-form ref="Breeding_recordsRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="母羊耳号" prop="eweManageTags">
|
||||||
|
<el-input v-model="form.eweManageTags" placeholder="请输入母羊耳号" @blur="getEweInfoByTags" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="公羊耳号" prop="ramManageTags">
|
||||||
|
<el-input v-model="form.ramManageTags" placeholder="请输入公羊耳号" @blur="getRamInfoByTags" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="耗精量" prop="breedDrugs">
|
||||||
|
<el-input v-model="form.breedDrugs" placeholder="请输入耗精量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" type="textarea" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</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="Breeding_records">
|
||||||
|
import { listBreeding_records, getBreeding_records, delBreeding_records, addBreeding_records, updateBreeding_records, getSheepInfoByTags } from "@/api/Breeding_records/Breeding_records"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const Breeding_recordsList = 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,
|
||||||
|
eweManageTags: null,
|
||||||
|
ramManageTags: null,
|
||||||
|
eweVariety: null,
|
||||||
|
ramVariety: null,
|
||||||
|
technician: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
eweManageTags: [
|
||||||
|
{ required: true, message: "母羊耳号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
ramManageTags: [
|
||||||
|
{ required: true, message: "公羊耳号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
technician: [
|
||||||
|
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询配种记录列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listBreeding_records(queryParams.value).then(response => {
|
||||||
|
Breeding_recordsList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
sheepId: null,
|
||||||
|
ramId: null,
|
||||||
|
eweId: null,
|
||||||
|
eweManageTags: null,
|
||||||
|
ramManageTags: null,
|
||||||
|
technician: null,
|
||||||
|
breedDrugs: null,
|
||||||
|
comment: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("Breeding_recordsRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加配种记录"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getBreeding_records(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改配种记录"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 根据母羊耳号获取羊只信息 */
|
||||||
|
function getEweInfoByTags() {
|
||||||
|
if (form.value.eweManageTags) {
|
||||||
|
getSheepInfoByTags(form.value.eweManageTags).then(response => {
|
||||||
|
if (response.data) {
|
||||||
|
form.value.eweId = response.data.id
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError("未找到该母羊耳号对应的羊只信息")
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
proxy.$modal.msgError("查询母羊信息失败")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 根据公羊耳号获取羊只信息 */
|
||||||
|
function getRamInfoByTags() {
|
||||||
|
if (form.value.ramManageTags) {
|
||||||
|
getSheepInfoByTags(form.value.ramManageTags).then(response => {
|
||||||
|
if (response.data) {
|
||||||
|
form.value.ramId = response.data.id
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError("未找到该公羊耳号对应的羊只信息")
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
proxy.$modal.msgError("查询公羊信息失败")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["Breeding_recordsRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateBreeding_records(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addBreeding_records(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除配种记录编号为"' + _ids + '"的数据项?').then(function() {
|
||||||
|
return delBreeding_records(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('Breeding_records/Breeding_records/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `配种记录_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.el-table {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.el-table .cell {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
423
src/views/Sperm/Sperm/index.vue
Normal file
423
src/views/Sperm/Sperm/index.vue
Normal file
@ -0,0 +1,423 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采精日期" prop="pickDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.pickDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择采精日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采精量" prop="amount">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.amount"
|
||||||
|
placeholder="请输入采精量"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="精液密度" prop="density">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.density"
|
||||||
|
placeholder="请输入精液密度"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="精液活力" prop="vitallity">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.vitallity"
|
||||||
|
placeholder="请输入精液活力"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否性控" prop="controlled">
|
||||||
|
<el-select v-model="queryParams.controlled" placeholder="请选择是否性控" clearable>
|
||||||
|
<el-option label="否" value="0" />
|
||||||
|
<el-option label="是" value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.technician"
|
||||||
|
placeholder="请输入技术员"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="阴囊周长" prop="scrotumCircumference">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.scrotumCircumference"
|
||||||
|
placeholder="请输入阴囊周长"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="精液品质" prop="semenQuality">
|
||||||
|
<el-select v-model="queryParams.semenQuality" placeholder="请选择精液品质" clearable>
|
||||||
|
<el-option label="A级" value="A" />
|
||||||
|
<el-option label="B级" value="B" />
|
||||||
|
<el-option label="C级" value="C" />
|
||||||
|
<el-option label="D级" value="D" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-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="['Sperm:Sperm:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['Sperm:Sperm:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['Sperm:Sperm:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['Sperm:Sperm:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="SpermList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="耳号" align="center" prop="manageTags" width="120" />
|
||||||
|
<el-table-column label="电子耳号" align="center" prop="electronicTags" width="120" />
|
||||||
|
<el-table-column label="月龄" align="center" prop="monthAge" width="80" />
|
||||||
|
<el-table-column label="采精日期" align="center" prop="pickDate" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.pickDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="采精量(ml)" align="center" prop="amount" width="100" />
|
||||||
|
<el-table-column label="精液密度" align="center" prop="density" width="100" />
|
||||||
|
<el-table-column label="精液活力" align="center" prop="vitallity" width="100" />
|
||||||
|
<el-table-column label="是否性控" align="center" prop="controlled" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.controlled == 1 ? '是' : '否' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="性欲情况" align="center" prop="sexualStatus" width="100" />
|
||||||
|
<el-table-column label="诊疗信息" align="center" prop="info" width="120" />
|
||||||
|
<el-table-column label="技术员" align="center" prop="technician" width="100" />
|
||||||
|
<el-table-column label="采精备注" align="center" prop="comment" width="120" />
|
||||||
|
<el-table-column label="阴囊周长(cm)" align="center" prop="scrotumCircumference" width="120" />
|
||||||
|
<el-table-column label="精液品质" align="center" prop="semenQuality" width="100" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['Sperm:Sperm:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['Sperm:Sperm:remove']">删除</el-button>
|
||||||
|
</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="600px" append-to-body>
|
||||||
|
<el-form ref="SpermRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="耳号" prop="manageTags">
|
||||||
|
<el-input v-model="form.manageTags" placeholder="请输入耳号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="采精日期" prop="pickDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.pickDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择采精日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="采精量" prop="amount">
|
||||||
|
<el-input v-model="form.amount" placeholder="请输入采精量(ml)" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="精液密度" prop="density">
|
||||||
|
<el-input v-model="form.density" placeholder="请输入精液密度" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="精液活力" prop="vitallity">
|
||||||
|
<el-input v-model="form.vitallity" placeholder="请输入精液活力" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否性控" prop="controlled">
|
||||||
|
<el-select v-model="form.controlled" placeholder="请选择是否性控">
|
||||||
|
<el-option label="否" :value="0" />
|
||||||
|
<el-option label="是" :value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="性欲情况" prop="sexualStatus">
|
||||||
|
<el-input v-model="form.sexualStatus" placeholder="请输入性欲情况" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="阴囊周长" prop="scrotumCircumference">
|
||||||
|
<el-input v-model="form.scrotumCircumference" placeholder="请输入阴囊周长(cm)" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="精液品质" prop="semenQuality">
|
||||||
|
<el-select v-model="form.semenQuality" placeholder="请选择精液品质">
|
||||||
|
<el-option label="A级" value="A" />
|
||||||
|
<el-option label="B级" value="B" />
|
||||||
|
<el-option label="C级" value="C" />
|
||||||
|
<el-option label="D级" value="D" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="诊疗信息" prop="info">
|
||||||
|
<el-input v-model="form.info" type="textarea" placeholder="请输入诊疗信息" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采集备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" type="textarea" 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="Sperm">
|
||||||
|
import { listSperm, getSperm, delSperm, addSperm, updateSperm } from "@/api/Sperm/Sperm"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const SpermList = 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,
|
||||||
|
manageTags: null,
|
||||||
|
pickDate: null,
|
||||||
|
amount: null,
|
||||||
|
density: null,
|
||||||
|
vitallity: null,
|
||||||
|
controlled: null,
|
||||||
|
sexualStatus: null,
|
||||||
|
info: null,
|
||||||
|
technician: null,
|
||||||
|
comment: null,
|
||||||
|
scrotumCircumference: null,
|
||||||
|
semenQuality: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
manageTags: [
|
||||||
|
{ required: true, message: "耳号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
pickDate: [
|
||||||
|
{ required: true, message: "采精日期不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
amount: [
|
||||||
|
{ required: true, message: "采精量不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询采精记录列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listSperm(queryParams.value).then(response => {
|
||||||
|
SpermList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
manageTags: null,
|
||||||
|
pickDate: null,
|
||||||
|
amount: null,
|
||||||
|
density: null,
|
||||||
|
vitallity: null,
|
||||||
|
controlled: 0,
|
||||||
|
sexualStatus: null,
|
||||||
|
info: null,
|
||||||
|
technician: null,
|
||||||
|
comment: null,
|
||||||
|
scrotumCircumference: null,
|
||||||
|
semenQuality: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("SpermRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加采精记录"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getSperm(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改采精记录"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["SpermRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateSperm(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addSperm(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除采精记录编号为"' + _ids + '"的数据项?').then(function() {
|
||||||
|
return delSperm(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('Sperm/Sperm/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `Sperm_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
1204
src/views/bas_ram_file/bas_ram_file/index.vue
Normal file
1204
src/views/bas_ram_file/bas_ram_file/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
347
src/views/feed/FeedPlan/index.vue
Normal file
347
src/views/feed/FeedPlan/index.vue
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="配方编码" prop="formulaId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.formulaId"
|
||||||
|
placeholder="请输入配方编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.sheepHouseId"
|
||||||
|
placeholder="请输入羊舍"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.zookeeper"
|
||||||
|
placeholder="请输入饲草班人员"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂计划日期" prop="planDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.planDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择饲喂计划日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['feed:FeedPlan:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['feed:FeedPlan:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['feed:FeedPlan:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['feed:FeedPlan:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="FeedPlanList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="创建日期" align="center" prop="createDate" />
|
||||||
|
<el-table-column label="配方编码" align="center" prop="formulaId" />
|
||||||
|
<el-table-column label="羊舍" align="center" prop="sheepHouseId">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="sheep_house_list" :value="scope.row.sheepHouseId"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="羊只数量" align="center" prop="sheepCount" />
|
||||||
|
<el-table-column label="日均计划量" align="center" prop="planDailySize" />
|
||||||
|
<el-table-column label="计划量(早)" align="center" prop="planMorningSize" />
|
||||||
|
<el-table-column label="计划总量(早)" align="center" prop="planMorningTotal" />
|
||||||
|
<el-table-column label="饲喂比例(早)" align="center" prop="ratioMorning" />
|
||||||
|
<el-table-column label="实际量(早)" align="center" prop="actualMorningSize" />
|
||||||
|
<el-table-column label="计划量(中)" align="center" prop="planNoonSize" />
|
||||||
|
<el-table-column label="计划总量(中)" align="center" prop="planNoonTotal" />
|
||||||
|
<el-table-column label="实际量(中)" align="center" prop="actualNoonSize" />
|
||||||
|
<el-table-column label="饲喂比例(中)" align="center" prop="ratioNoon" />
|
||||||
|
<el-table-column label="计划量(下)" align="center" prop="planAfternoonSize" />
|
||||||
|
<el-table-column label="计划总量(下)" align="center" prop="planAfternoonTotal" />
|
||||||
|
<el-table-column label="实际量(下)" align="center" prop="actualAfternoonSize" />
|
||||||
|
<el-table-column label="饲喂比例(下)" align="center" prop="ratioAfternoon" />
|
||||||
|
<el-table-column label="计划饲喂总量" align="center" prop="planFeedTotal" />
|
||||||
|
<el-table-column label="饲草班人员" align="center" prop="zookeeper" />
|
||||||
|
<el-table-column label="饲喂计划日期" align="center" prop="planDate" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['feed:FeedPlan:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['feed:FeedPlan:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改饲喂计划对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="FeedPlanRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="配方编码" prop="formulaId">
|
||||||
|
<el-input v-model="form.formulaId" placeholder="请输入配方编码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="羊舍" prop="sheepHouseId">
|
||||||
|
<el-input v-model="form.sheepHouseId" placeholder="请输入羊舍" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="日均计划量" prop="planDailySize">
|
||||||
|
<el-input v-model="form.planDailySize" placeholder="请输入日均计划量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂比例(早)" prop="ratioMorning">
|
||||||
|
<el-input v-model="form.ratioMorning" placeholder="请输入饲喂比例(早)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="实际量(早)" prop="actualMorningSize">
|
||||||
|
<el-input v-model="form.actualMorningSize" placeholder="请输入实际量(早)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="实际量(中)" prop="actualNoonSize">
|
||||||
|
<el-input v-model="form.actualNoonSize" placeholder="请输入实际量(中)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂比例(中)" prop="ratioNoon">
|
||||||
|
<el-input v-model="form.ratioNoon" placeholder="请输入饲喂比例(中)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="实际量(下)" prop="actualAfternoonSize">
|
||||||
|
<el-input v-model="form.actualAfternoonSize" placeholder="请输入实际量(下)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂比例(下)" prop="ratioAfternoon">
|
||||||
|
<el-input v-model="form.ratioAfternoon" placeholder="请输入饲喂比例(下)" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲草班人员" prop="zookeeper">
|
||||||
|
<el-input v-model="form.zookeeper" placeholder="请输入饲草班人员" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="饲喂计划日期" prop="planDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.planDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择饲喂计划日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="FeedPlan">
|
||||||
|
import { listFeedPlan, getFeedPlan, delFeedPlan, addFeedPlan, updateFeedPlan } from "@/api/feed/FeedPlan"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const FeedPlanList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
formulaId: null,
|
||||||
|
sheepHouseId: null,
|
||||||
|
zookeeper: null,
|
||||||
|
planDate: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
formulaId: [
|
||||||
|
{ required: true, message: "配方编码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepHouseId: [
|
||||||
|
{ required: true, message: "羊舍不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
planDailySize: [
|
||||||
|
{ required: true, message: "日均计划量不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询饲喂计划列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listFeedPlan(queryParams.value).then(response => {
|
||||||
|
FeedPlanList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
createDate: null,
|
||||||
|
formulaId: null,
|
||||||
|
sheepHouseId: null,
|
||||||
|
sheepCount: null,
|
||||||
|
planDailySize: null,
|
||||||
|
planMorningSize: null,
|
||||||
|
planMorningTotal: null,
|
||||||
|
ratioMorning: null,
|
||||||
|
actualMorningSize: null,
|
||||||
|
planNoonSize: null,
|
||||||
|
planNoonTotal: null,
|
||||||
|
actualNoonSize: null,
|
||||||
|
ratioNoon: null,
|
||||||
|
planAfternoonSize: null,
|
||||||
|
planAfternoonTotal: null,
|
||||||
|
actualAfternoonSize: null,
|
||||||
|
ratioAfternoon: null,
|
||||||
|
planFeedTotal: null,
|
||||||
|
zookeeper: null,
|
||||||
|
planDate: null,
|
||||||
|
remark: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("FeedPlanRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.createDate)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加饲喂计划"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _createDate = row.createDate || ids.value
|
||||||
|
getFeedPlan(_createDate).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改饲喂计划"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["FeedPlanRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.createDate != null) {
|
||||||
|
updateFeedPlan(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addFeedPlan(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _createDates = row.createDate || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除饲喂计划编号为"' + _createDates + '"的数据项?').then(function() {
|
||||||
|
return delFeedPlan(_createDates)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('feed/FeedPlan/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `FeedPlan_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
229
src/views/feed/FormulaList/index.vue
Normal file
229
src/views/feed/FormulaList/index.vue
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="原料编号" prop="materialId">
|
||||||
|
<el-input v-model="queryParams.materialId" placeholder="请输入原料编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="原料名称" prop="materialName">
|
||||||
|
<el-input v-model="queryParams.materialName" placeholder="请输入原料名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="比例" prop="ratio">
|
||||||
|
<el-input v-model="queryParams.ratio" placeholder="请输入比例" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
|
v-hasPermi="['feed:FormulaList:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
|
v-hasPermi="['feed:FormulaList:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['feed:FormulaList:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['feed:FormulaList:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="FormulaListList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="序号" align="center" prop="code" />
|
||||||
|
<el-table-column label="配方编号" align="center" prop="formulaId" />
|
||||||
|
<el-table-column label="原料编号" align="center" prop="materialId" />
|
||||||
|
<el-table-column label="原料名称" align="center" prop="materialName" />
|
||||||
|
<el-table-column label="比例" align="center" prop="ratio" />
|
||||||
|
<el-table-column label="颗粒原料" align="center" prop="isGranular" />
|
||||||
|
<el-table-column label="补饲" align="center" prop="isSupplement" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaList:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaList:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 添加或修改配方列表对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="FormulaListRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="原料编号" prop="materialId">
|
||||||
|
<el-input v-model="form.materialId" placeholder="请输入原料编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="原料名称" prop="materialName">
|
||||||
|
<el-input v-model="form.materialName" placeholder="请输入原料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="比例" prop="ratio">
|
||||||
|
<el-input v-model="form.ratio" placeholder="请输入比例" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="FormulaList">
|
||||||
|
import { listFormulaList, getFormulaList, delFormulaList, addFormulaList, updateFormulaList } from "@/api/feed/FormulaList"
|
||||||
|
import { reactive } from "vue"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const FormulaListList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
batchId: "0",
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
ratio: null,
|
||||||
|
isGranular: null,
|
||||||
|
isSupplement: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
ratio: [
|
||||||
|
{ required: true, message: "比例不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
|
||||||
|
/** 查询配方列表列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listFormulaList(queryParams.value).then(response => {
|
||||||
|
FormulaListList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
code: null,
|
||||||
|
formulaId: null,
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
ratio: null,
|
||||||
|
isGranular: null,
|
||||||
|
isSupplement: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("FormulaListRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.code)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加配方列表"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _code = row.code || ids.value
|
||||||
|
getFormulaList(_code).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改配方列表"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["FormulaListRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.code != null) {
|
||||||
|
updateFormulaList(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addFormulaList(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _codes = row.code || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除配方列表编号为"' + _codes + '"的数据项?').then(function () {
|
||||||
|
return delFormulaList(_codes)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('feed/FormulaList/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `FormulaList_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
717
src/views/feed/FormulaManagement/index.vue
Normal file
717
src/views/feed/FormulaManagement/index.vue
Normal file
@ -0,0 +1,717 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="饲养阶段" prop="feedStage">
|
||||||
|
<el-input v-model="queryParams.feedStage" placeholder="请输入饲养阶段" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="批号" prop="batchId">
|
||||||
|
<el-input v-model="queryParams.batchId" placeholder="请输入批号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAddFormulatemplate"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:edit']" v-show="false">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:remove']" v-show="false">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="FormulaManagementList">
|
||||||
|
<!-- 表中表展示子配方 -->
|
||||||
|
<el-table-column type="expand" @expand-change="handleExpandChange">
|
||||||
|
<template #default="props">
|
||||||
|
<el-table :data="props.row.subFormulaList" style="width: 100%">
|
||||||
|
<el-table-column label="批号" align="center" prop="batchId" />
|
||||||
|
<el-table-column label="饲养阶段" align="center" prop="feedStage" />
|
||||||
|
<el-table-column label="开始使用时间" align="center" prop="useStartDate" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.useStartDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="结束使用时间" align="center" prop="useEndDate" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.useEndDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="使用状态" align="center" prop="useState">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="pres_status" :value="scope.row.useState" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleFormulaDetailUpdate(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleFormulaDelete(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="配方编号" align="center" prop="formulaId" />
|
||||||
|
<el-table-column label="饲养阶段" align="center" prop="feedStage" />
|
||||||
|
<el-table-column label="使用状态" align="center" prop="useState">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="pres_status" :value="scope.row.useState" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Plus" @click="handleAddSgFormulaList(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:add']">新增</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleFormulaTemplateUpdate(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleFormulaDelete(scope.row)"
|
||||||
|
v-hasPermi="['feed:FormulaManagement:remove']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 添加或修改配方管理对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="FormulaManagementRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="饲养阶段" prop="feedStage">
|
||||||
|
<el-input v-model="form.feedStage" placeholder="请输入饲养阶段" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开始使用时间" prop="useStartDate">
|
||||||
|
<el-date-picker clearable v-model="form.useStartDate" type="date" value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择开始使用时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束使用时间" prop="useEndDate">
|
||||||
|
<el-date-picker clearable v-model="form.useEndDate" type="date" value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择结束使用时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 弹框:详情/修改 -->
|
||||||
|
<el-dialog :title="title" v-model="formulaListOpen" width="60%" append-to-body s>
|
||||||
|
<!-- 详情页:只读展示 -->
|
||||||
|
<div v-if="isView" style="padding-bottom:20px ;">
|
||||||
|
<el-descriptions :column="2" border>
|
||||||
|
<el-descriptions-item label="配方批号">{{ showFormulaManagementList.batchId }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="饲养阶段">{{ showFormulaManagementList.feedStage }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="开始使用时间">
|
||||||
|
<span>{{ parseTime(showFormulaManagementList.useStartDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="结束使用时间">
|
||||||
|
<span>{{ parseTime(showFormulaManagementList.useEndDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="使用状态">
|
||||||
|
<dict-tag :options="pres_status" :value="showFormulaManagementList.useState" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注" :span="2">
|
||||||
|
{{ showFormulaManagementList.remark || '无' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<el-divider content-position="left">配方列表</el-divider>
|
||||||
|
|
||||||
|
<el-table :data="showFormulaManagementList.sgFormulaList" stripe border style="width: 100%" max-height="300">
|
||||||
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||||
|
<el-table-column label="原料编号" prop="materialId" align="center" />
|
||||||
|
<el-table-column label="原料名称" prop="materialName" />
|
||||||
|
<el-table-column label="比例" align="center" prop="ratio" />
|
||||||
|
<el-table-column label="类型" prop="isGranular" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="materialType" :value="scope.row.isGranular" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 修改页:可编辑表单 -->
|
||||||
|
<div v-else>
|
||||||
|
<el-form ref="FormulaManagementRef" :model="showFormulaManagementList" :rules="rules" label-width="100px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12" v-if="!isView">
|
||||||
|
<el-form-item label="配方编号" prop="formulaId">
|
||||||
|
<el-input v-model="showFormulaManagementList.formulaId" placeholder="请输入配方编号"
|
||||||
|
:disabled="!FormulaIdEditable"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="批号" prop="batchId">
|
||||||
|
<el-input v-model="showFormulaManagementList.batchId" placeholder="请输入配方批号"
|
||||||
|
:disabled="!BatchIdEditable" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="饲养阶段" prop="feedStage">
|
||||||
|
<el-input v-model="showFormulaManagementList.feedStage" placeholder="请输入饲养阶段" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="开始使用时间" prop="useStartDate">
|
||||||
|
<el-date-picker clearable v-model="showFormulaManagementList.useStartDate" type="date"
|
||||||
|
value-format="YYYY-MM-DD" placeholder="请选择开始使用时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="结束使用时间" prop="useEndDate">
|
||||||
|
<el-date-picker clearable v-model="showFormulaManagementList.useEndDate" type="date"
|
||||||
|
value-format="YYYY-MM-DD" placeholder="请选择结束使用时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="使用状态" prop="useState">
|
||||||
|
<el-select v-model="showFormulaManagementList.useState" placeholder="请选择使用状态">
|
||||||
|
<el-option v-for="item in useStaus" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input type="textarea" :rows="2" v-model="showFormulaManagementList.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider content-position="left">配方详情</el-divider>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" icon="Plus" @click="handleAddSgFormulaListDetail()">添加</el-button>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table :data="showFormulaManagementList.sgFormulaList" :rules="rules"
|
||||||
|
:row-class-name="rowSgFormulaListDetailIndex" @selection-change="handleSgFormulaListDetailSelectionChange"
|
||||||
|
ref="swPresDetail" border stripe>
|
||||||
|
<el-table-column label="序号" align="center" prop="index" width="60" />
|
||||||
|
<el-table-column label="原料" prop="materialId">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-select v-model="scope.row.materialId" filterable placeholder="请选择原料" style="width: 100%"
|
||||||
|
@change="handleMaterialChange(scope.row, $event)">
|
||||||
|
<el-option v-for="item in materials" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="比例" prop="dosage">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input-number v-model="scope.row.ratio" placeholder="请输入比例" :min="0" :precision="1"
|
||||||
|
controls-position="right" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="类型" prop="isGranular">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-select v-model="scope.row.isGranular" placeholder="请选择类型">
|
||||||
|
<el-option v-for="item in materialType" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Delete" @click="deleteFormulaListDetail(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 底部按钮:仅修改页显示 -->
|
||||||
|
<template #footer v-if="!isView">
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submitFormulaListForm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { listFormulaManagement, getFormulaManagement, delFormulaManagement, addFormulaManagement, updateFormulaManagement } from "@/api/feed/FormulaManagement"
|
||||||
|
import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
|
||||||
|
import { listFormulaList, getFormulaList, delFormulaList, addFormulaList, updateFormulaList } from "@/api/feed/FormulaList"
|
||||||
|
import { listMaterial } from "@/api/feed/Material"
|
||||||
|
import { fa } from "element-plus/es/locales.mjs"
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { pres_status } = proxy.useDict('pres_status')
|
||||||
|
// Data and refs
|
||||||
|
const FormulaManagementList = ref([])
|
||||||
|
const showFormulaManagementList = ref([])
|
||||||
|
const FormulaDetailList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
const expandedRows = ref([]) // Track expanded rows
|
||||||
|
const isView = ref(false)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add : 添加配方
|
||||||
|
* update : 修改配方
|
||||||
|
*/
|
||||||
|
const operationType = ref("") // 操作类型:add 或 update
|
||||||
|
// 控制批号是否可编辑
|
||||||
|
const BatchIdEditable = ref(false)
|
||||||
|
const FormulaIdEditable = ref(false)
|
||||||
|
// 原料下拉列表
|
||||||
|
const materials = ref([])
|
||||||
|
// 原料类型
|
||||||
|
const materialType = [
|
||||||
|
{ value: '1', label: '颗粒料' },
|
||||||
|
{ value: '0', label: '其他' }
|
||||||
|
]
|
||||||
|
const useStaus = [
|
||||||
|
{ value: '1', label: '启用' },
|
||||||
|
{ value: '0', label: '停用' }
|
||||||
|
]
|
||||||
|
const checkedSwPresDetail = ref([]) // 子表选中的行序号数组
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
feedStage: null,
|
||||||
|
batchId: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
formulaId: [
|
||||||
|
{ required: true, message: "配方编号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
feedStage: [
|
||||||
|
{ required: true, message: "饲养阶段不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
ratio: [
|
||||||
|
{ required: true, message: "比例不能为空", trigger: "blur" },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
|
||||||
|
const formulaForm = ref({
|
||||||
|
materialId: '',
|
||||||
|
materialName: '',
|
||||||
|
ratio: '',
|
||||||
|
isGranular: false
|
||||||
|
})
|
||||||
|
const formulaListOpen = ref(false)
|
||||||
|
/** 查询配方管理列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listFormulaManagement(queryParams.value).then(response => {
|
||||||
|
FormulaManagementList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
console.log("配方管理列表数据:", FormulaManagementList.value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理展开行的变化
|
||||||
|
function handleExpandChange(row, expandedRows) {
|
||||||
|
// 收起其他行
|
||||||
|
expandedRows.forEach(r => {
|
||||||
|
if (r !== row) {
|
||||||
|
mainTable.value.toggleRowExpansion(r, false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 如果是展开状态,刷新子表数据
|
||||||
|
const isExpanded = expandedRows.includes(row)
|
||||||
|
if (isExpanded) {
|
||||||
|
loading.value = true
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
formulaListOpen.value = false
|
||||||
|
formulaFormReset()
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
formulaId: null,
|
||||||
|
feedStage: null,
|
||||||
|
batchId: null,
|
||||||
|
useStartDate: null,
|
||||||
|
useEndDate: null,
|
||||||
|
useState: null,
|
||||||
|
remark: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("FormulaManagementRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.formulaId)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAddFormulatemplate() {
|
||||||
|
formulaFormReset()
|
||||||
|
reset()
|
||||||
|
operationType.value = "add"
|
||||||
|
// 模板禁用批号编辑
|
||||||
|
BatchIdEditable.value = false
|
||||||
|
// 添加模板时配方编号可编辑
|
||||||
|
FormulaIdEditable.value = true
|
||||||
|
isView.value = false
|
||||||
|
// 初始化表单
|
||||||
|
showFormulaManagementList.value = {
|
||||||
|
formulaId: null,
|
||||||
|
// 模板批号为 0
|
||||||
|
batchId: "0",
|
||||||
|
feedStage: null,
|
||||||
|
useStartDate: null,
|
||||||
|
useEndDate: null,
|
||||||
|
useState: '1', // 默认启用
|
||||||
|
remark: null,
|
||||||
|
sgFormulaList: [{
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
ratio: null,
|
||||||
|
isGranular: "0",
|
||||||
|
isSupplement: "0"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
formulaListOpen.value = true
|
||||||
|
title.value = "添加配方管理模板"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleFormulaTemplateUpdate(row) {
|
||||||
|
reset()
|
||||||
|
operationType.value = "update"
|
||||||
|
const _id = row.formulaId || ids.value
|
||||||
|
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||||
|
FormulaIdEditable.value = false // 修改时配方编号不可编辑
|
||||||
|
const batchId = row.batchId
|
||||||
|
const queryParams = {
|
||||||
|
formulaId: _id,
|
||||||
|
batchId: batchId,
|
||||||
|
queryType: "query"
|
||||||
|
}
|
||||||
|
listFormulaManagement(queryParams).then(response => {
|
||||||
|
if (response.rows && response.rows.length > 0) {
|
||||||
|
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||||
|
} else {
|
||||||
|
showFormulaManagementList.value = {}
|
||||||
|
}
|
||||||
|
formulaListOpen.value = true
|
||||||
|
title.value = "修改处方"
|
||||||
|
isView.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.formulaId != null) {
|
||||||
|
updateFormulaManagement(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addFormulaManagement(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _formulaIds = row.formulaId || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除配方管理编号为"' + _formulaIds + '"的数据项?').then(function () {
|
||||||
|
return delFormulaManagement(_formulaIds)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ================= 配方列表操作 ================= */
|
||||||
|
function handleAddSgFormulaList(row) {
|
||||||
|
formulaFormReset()
|
||||||
|
reset()
|
||||||
|
operationType.value = "add"
|
||||||
|
BatchIdEditable.value = true
|
||||||
|
FormulaIdEditable.value = false
|
||||||
|
isView.value = false
|
||||||
|
console.log(row.sgFormulaList)
|
||||||
|
// 初始化表单
|
||||||
|
showFormulaManagementList.value = {
|
||||||
|
formulaId: row.formulaId || null,
|
||||||
|
batchId: null,
|
||||||
|
feedStage: null,
|
||||||
|
useStartDate: null,
|
||||||
|
useEndDate: null,
|
||||||
|
useState: '1', // 默认启用
|
||||||
|
remark: null,
|
||||||
|
sgFormulaList: row.sgFormulaList || [{
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
ratio: null,
|
||||||
|
isGranular: "0",
|
||||||
|
isSupplement: "0"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
formulaListOpen.value = true
|
||||||
|
title.value = "添加配方"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleFormulaUpdate(row) {
|
||||||
|
formulaFormReset()
|
||||||
|
const _code = row.code || ids.value
|
||||||
|
getFormulaList(_code).then(response => {
|
||||||
|
formulaForm.value = response.data
|
||||||
|
if (formulaForm.value.isGranular === "1") {
|
||||||
|
formulaForm.value.isGranular = true
|
||||||
|
} else {
|
||||||
|
formulaForm.value.isGranular = false
|
||||||
|
}
|
||||||
|
console.log("formulaForm: ", formulaForm.value)
|
||||||
|
formulaListOpen.value = true
|
||||||
|
FormulaIdEditable.value = false
|
||||||
|
title.value = "修改配方列表"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleFormulaDelete(row) {
|
||||||
|
const _codes = row.formulaId + "/" + row.batchId
|
||||||
|
proxy.$modal.confirm('是否确认删除配方列表编号为"' + _codes + '"的数据项?').then(function () {
|
||||||
|
return delFormulaManagement(_codes)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitFormulaListForm() {
|
||||||
|
proxy.$refs["FormulaManagementRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (showFormulaManagementList.value.formulaId != null && operationType.value === "update") {
|
||||||
|
updateFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
formulaListOpen.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else if (operationType.value === "add" && showFormulaManagementList.value.formulaId != null && showFormulaManagementList.value.batchId != null) {
|
||||||
|
addFormulaManagement(showFormulaManagementList.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
formulaListOpen.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 原料下拉选择变化时,更新对应的原料名称
|
||||||
|
function handleMaterialChange(row, selectedValue) {
|
||||||
|
const selectedItem = this.materials.find(item => item.value === selectedValue);
|
||||||
|
if (selectedItem) {
|
||||||
|
// materialName 也在 row 中
|
||||||
|
row.materialName = selectedItem.label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看详情
|
||||||
|
* 根据 id 拉取单条记录及子表数据,弹窗只读展示
|
||||||
|
*/
|
||||||
|
function handleView(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.formulaId || ids.value
|
||||||
|
const batchId = row.batchId
|
||||||
|
const queryParams = {
|
||||||
|
formulaId: _id,
|
||||||
|
batchId: batchId,
|
||||||
|
queryType: "query"
|
||||||
|
}
|
||||||
|
listFormulaManagement(queryParams).then(response => {
|
||||||
|
if (response.rows && response.rows.length > 0) {
|
||||||
|
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||||
|
} else {
|
||||||
|
showFormulaManagementList.value = {}
|
||||||
|
}
|
||||||
|
title.value = "配方详情"
|
||||||
|
isView.value = true
|
||||||
|
formulaListOpen.value = true
|
||||||
|
console.log("handleView showFormulaManagementList: ", showFormulaManagementList.value);
|
||||||
|
console.log("handleView response: ", response);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改按钮
|
||||||
|
* 与查看详情共用接口,但弹窗可编辑
|
||||||
|
*/
|
||||||
|
function handleFormulaDetailUpdate(row) {
|
||||||
|
reset()
|
||||||
|
operationType.value = "update"
|
||||||
|
const _id = row.formulaId || ids.value
|
||||||
|
BatchIdEditable.value = false // 修改时批号不可编辑
|
||||||
|
const batchId = row.batchId
|
||||||
|
const queryParams = {
|
||||||
|
formulaId: _id,
|
||||||
|
batchId: batchId,
|
||||||
|
queryType: "query"
|
||||||
|
}
|
||||||
|
listFormulaManagement(queryParams).then(response => {
|
||||||
|
if (response.rows && response.rows.length > 0) {
|
||||||
|
showFormulaManagementList.value = response.rows[0] // 取第一条记录
|
||||||
|
} else {
|
||||||
|
showFormulaManagementList.value = {}
|
||||||
|
}
|
||||||
|
formulaListOpen.value = true
|
||||||
|
title.value = "修改处方"
|
||||||
|
isView.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加项
|
||||||
|
function handleAddSgFormulaListDetail() {
|
||||||
|
showFormulaManagementList.value.sgFormulaList.push({
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
ratio: null,
|
||||||
|
isGranular: "0",
|
||||||
|
isSupplement: "0"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除项
|
||||||
|
function deleteFormulaListDetail(row) {
|
||||||
|
const index = showFormulaManagementList.value.sgFormulaList.findIndex(item => item.index === row.index)
|
||||||
|
if (index !== -1) {
|
||||||
|
showFormulaManagementList.value.sgFormulaList.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 表单重置
|
||||||
|
function formulaFormReset() {
|
||||||
|
form.value = {
|
||||||
|
code: null,
|
||||||
|
formulaId: null,
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
ratio: null,
|
||||||
|
isGranular: null,
|
||||||
|
isSupplement: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("FormulaListRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 原料列表查询参数
|
||||||
|
const materialQueryParams = ref({
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
isGranular: null
|
||||||
|
})
|
||||||
|
function getMaterials() {
|
||||||
|
listMaterial(materialQueryParams).then(response => {
|
||||||
|
console.log("获取原料列表:", response)
|
||||||
|
materials.value = response.rows.map(item => ({
|
||||||
|
value: item.materialId,
|
||||||
|
label: item.materialName
|
||||||
|
}))
|
||||||
|
console.log("原料列表:", materials.value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子表多选回调
|
||||||
|
* 记录被选中的行序号数组
|
||||||
|
*/
|
||||||
|
function handleSgFormulaListDetailSelectionChange(selection) {
|
||||||
|
checkedSwPresDetail.value = selection.map(item => item.index)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 子表行序号计算
|
||||||
|
* 通过 el-table 的 row-class-name 钩子给每一行写入 index(从 1 开始)
|
||||||
|
*/
|
||||||
|
function rowSgFormulaListDetailIndex({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ================================= */
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('feed/FormulaManagement/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `FormulaManagement_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化加载数据
|
||||||
|
getList()
|
||||||
|
// 加载原料列表
|
||||||
|
getMaterials()
|
||||||
|
</script>
|
172
src/views/fileManagement/sheep_structure/index.vue
Normal file
172
src/views/fileManagement/sheep_structure/index.vue
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<!-- 顶部存栏总数 -->
|
||||||
|
<el-row :gutter="20" class="top-summary">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-card shadow="hover" class="summary-card">
|
||||||
|
<div class="summary-content">
|
||||||
|
<el-icon size="48" color="#409EFF"><Collection /></el-icon>
|
||||||
|
<div>
|
||||||
|
<div class="summary-title">存栏羊只总数</div>
|
||||||
|
<div class="summary-value">{{ inGroupCount }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 图表区域 -->
|
||||||
|
<el-row :gutter="20" class="chart-row">
|
||||||
|
<!-- 羊只类别 -->
|
||||||
|
<el-col :xs="24" :sm="24" :md="12" :lg="12">
|
||||||
|
<el-card shadow="hover" class="chart-card">
|
||||||
|
<template #header>
|
||||||
|
<span class="card-title">羊只类别分布</span>
|
||||||
|
</template>
|
||||||
|
<div ref="typePie" class="chart-box"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<!-- 泌乳羊胎次 -->
|
||||||
|
<el-col :xs="24" :sm="24" :md="12" :lg="12">
|
||||||
|
<el-card shadow="hover" class="chart-card">
|
||||||
|
<template #header>
|
||||||
|
<span class="card-title">泌乳羊胎次分布</span>
|
||||||
|
</template>
|
||||||
|
<div ref="parityPie" class="chart-box"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20" class="chart-row">
|
||||||
|
<!-- 繁育状态 -->
|
||||||
|
<el-col :xs="24" :sm="24" :md="12" :lg="12">
|
||||||
|
<el-card shadow="hover" class="chart-card">
|
||||||
|
<template #header>
|
||||||
|
<span class="card-title">繁育状态分布</span>
|
||||||
|
</template>
|
||||||
|
<div ref="breedBar" class="chart-box"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<!-- 品种分布 -->
|
||||||
|
<el-col :xs="24" :sm="24" :md="12" :lg="12">
|
||||||
|
<el-card shadow="hover" class="chart-card">
|
||||||
|
<template #header>
|
||||||
|
<span class="card-title">品种分布</span>
|
||||||
|
</template>
|
||||||
|
<div ref="varietyBar" class="chart-box"></div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import * as echarts from 'echarts'
|
||||||
|
import { Collection } from '@element-plus/icons-vue'
|
||||||
|
import {
|
||||||
|
getInGroupCount,
|
||||||
|
getSheepTypeStat,
|
||||||
|
getBreedStatusStat,
|
||||||
|
getVarietyStat,
|
||||||
|
getLactationParityStat
|
||||||
|
} from '@/api/fileManagement/sheep_file'
|
||||||
|
|
||||||
|
const inGroupCount = ref(0)
|
||||||
|
const typePie = ref(null)
|
||||||
|
const parityPie = ref(null)
|
||||||
|
const breedBar = ref(null)
|
||||||
|
const varietyBar = ref(null)
|
||||||
|
|
||||||
|
let chart1, chart2, chart3, chart4
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
chart1 = echarts.init(typePie.value)
|
||||||
|
chart2 = echarts.init(parityPie.value)
|
||||||
|
chart3 = echarts.init(breedBar.value)
|
||||||
|
chart4 = echarts.init(varietyBar.value)
|
||||||
|
|
||||||
|
loadCharts()
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
chart1.resize(); chart2.resize(); chart3.resize(); chart4.resize()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function loadCharts() {
|
||||||
|
const pieOption = (data, title) => ({
|
||||||
|
title: { text: title, left: 'center', textStyle: { fontWeight: 'bold' } },
|
||||||
|
tooltip: { trigger: 'item' },
|
||||||
|
legend: { orient: 'vertical', left: 'left' },
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: 'pie',
|
||||||
|
radius: '60%',
|
||||||
|
data,
|
||||||
|
emphasis: {
|
||||||
|
itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0,0,0,0.5)' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const barOption = (data, title) => ({
|
||||||
|
title: { text: title, left: 'center', textStyle: { fontWeight: 'bold' } },
|
||||||
|
tooltip: {},
|
||||||
|
grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
|
||||||
|
xAxis: { type: 'category', data: data.map(i => i.name) },
|
||||||
|
yAxis: { type: 'value' },
|
||||||
|
series: [{ type: 'bar', data: data.map(i => i.value), itemStyle: { borderRadius: [4, 4, 0, 0] } }]
|
||||||
|
})
|
||||||
|
|
||||||
|
getInGroupCount().then(res => (inGroupCount.value = res.data))
|
||||||
|
getSheepTypeStat().then(res => chart1.setOption(pieOption(res.data, '羊只类别分布')))
|
||||||
|
getLactationParityStat().then(res => chart2.setOption(pieOption(res.data, '泌乳羊胎次分布')))
|
||||||
|
getBreedStatusStat().then(res => chart3.setOption(barOption(res.data, '繁育状态分布')))
|
||||||
|
getVarietyStat().then(res => chart4.setOption(barOption(res.data, '品种分布')))
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 顶部卡片 */
|
||||||
|
.top-summary {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.summary-card {
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.summary-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.summary-title {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #909399;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.summary-value {
|
||||||
|
font-size: 36px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 图表卡片 */
|
||||||
|
.chart-row {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.chart-card {
|
||||||
|
border-radius: 12px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.card-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
.chart-box {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -102,15 +102,27 @@
|
|||||||
:value="sheep.manageTags" />
|
:value="sheep.manageTags" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="转出羊舍" prop="foldFrom">
|
<!-- 在el-form中新增牧场选择项 -->
|
||||||
<el-select v-model="form.foldFrom" placeholder="请选择转出羊舍" clearable @change="handleSheepFilter"
|
<el-form-item label="牧场" prop="ranchId">
|
||||||
:disabled="!isAdd">
|
<el-select v-model="form.ranchId" placeholder="请选择牧场" clearable @change="handleRanchChange">
|
||||||
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
<el-option v-for="ranch in ranchOptions" :key="ranch.id" :label="ranch.ranchName" :value="ranch.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 调整转出羊舍的options为当前牧场的羊舍 -->
|
||||||
|
<el-form-item label="转出羊舍" prop="foldFrom">
|
||||||
|
<el-select v-model="form.foldFrom" placeholder="请选择转出羊舍" clearable :disabled="!form.ranchId"
|
||||||
|
@change="handleSheepFilter">
|
||||||
|
<el-option v-for="fold in currentRanchSheepfolds" :key="fold.id" :label="fold.sheepfoldName"
|
||||||
|
:value="fold.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 调整转入羊舍的options为当前牧场的羊舍 -->
|
||||||
<el-form-item label="转入羊舍" prop="foldTo">
|
<el-form-item label="转入羊舍" prop="foldTo">
|
||||||
<el-select v-model="form.foldTo" placeholder="请选择转入羊舍" clearable :disabled="!isAdd">
|
<el-select v-model="form.foldTo" placeholder="请选择转入羊舍" clearable :disabled="!form.ranchId">
|
||||||
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
<el-option v-for="fold in currentRanchSheepfolds" :key="fold.id" :label="fold.sheepfoldName"
|
||||||
|
:value="fold.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="isAdd" label="羊只类型" prop="sheepTypeId">
|
<el-form-item v-if="isAdd" label="羊只类型" prop="sheepTypeId">
|
||||||
@ -175,7 +187,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Trans_group">
|
<script setup name="Trans_group">
|
||||||
import { listTrans_group, getTrans_group, delTrans_group, addTrans_group, updateTrans_group, approveScTransGroup } from '@/api/produce/manage_sheep/trans_group'
|
import { listTrans_group, getTrans_group, delTrans_group, addTrans_group, updateTrans_group, approveScTransGroup, listRanch } from '@/api/produce/manage_sheep/trans_group'
|
||||||
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
import { listSheepfold_management as listSheepfold } from '@/api/fileManagement/sheepfold_management'
|
||||||
import { checkSheepByManageTags, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
|
import { checkSheepByManageTags, getSheepBySheepfoldId } from '@/api/produce/other/fixHoof'
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
@ -203,6 +215,8 @@ const sheepfoldNameMap = ref({});
|
|||||||
const varietyOptions = ref([]);
|
const varietyOptions = ref([]);
|
||||||
const sheepTypeOptions = ref([]);
|
const sheepTypeOptions = ref([]);
|
||||||
const isAdd = ref(false);
|
const isAdd = ref(false);
|
||||||
|
const ranchOptions = ref([]);
|
||||||
|
const currentRanchSheepfolds = ref([]);
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {
|
form: {
|
||||||
@ -214,6 +228,7 @@ const data = reactive({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
manageTags: null,
|
manageTags: null,
|
||||||
|
ranchId: null,
|
||||||
foldTo: null,
|
foldTo: null,
|
||||||
foldFrom: null,
|
foldFrom: null,
|
||||||
varietyId: null,
|
varietyId: null,
|
||||||
@ -222,6 +237,7 @@ const data = reactive({
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
manageTags: [{ required: true, message: '请输入耳号', trigger: 'blur' }],
|
manageTags: [{ required: true, message: '请输入耳号', trigger: 'blur' }],
|
||||||
|
ranchId: [{ required: true, message: '请选择牧场', trigger: 'change' }],
|
||||||
foldTo: [{ required: true, message: '请选择转入羊舍', trigger: 'change' }],
|
foldTo: [{ required: true, message: '请选择转入羊舍', trigger: 'change' }],
|
||||||
varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }],
|
varietyId: [{ required: true, message: '请选择品种', trigger: 'change' }],
|
||||||
reason: [{ required: true, message: '请选择转群原因', trigger: 'change' }],
|
reason: [{ required: true, message: '请选择转群原因', trigger: 'change' }],
|
||||||
@ -250,6 +266,7 @@ function reset() {
|
|||||||
form.value = {
|
form.value = {
|
||||||
id: null,
|
id: null,
|
||||||
sheepId: null,
|
sheepId: null,
|
||||||
|
ranchId: null,
|
||||||
foldFrom: null,
|
foldFrom: null,
|
||||||
foldTo: null,
|
foldTo: null,
|
||||||
varietyId: null,
|
varietyId: null,
|
||||||
@ -268,10 +285,17 @@ function reset() {
|
|||||||
|
|
||||||
//新增时判断筛选条件
|
//新增时判断筛选条件
|
||||||
async function handleSheepFilter() {
|
async function handleSheepFilter() {
|
||||||
const { foldFrom, sheepTypeId } = form.value;
|
const { foldFrom, sheepTypeId, ranchId } = form.value;
|
||||||
let isOnlySheepfold = false;
|
let isOnlySheepfold = false;
|
||||||
let isOnlyTypeOrCombined = false;
|
let isOnlyTypeOrCombined = false;
|
||||||
|
|
||||||
|
if (!ranchId) {
|
||||||
|
form.value.manageTags = [];
|
||||||
|
sheepOptions.value = [];
|
||||||
|
proxy.$message.warning("请先选择牧场");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (foldFrom && !sheepTypeId) {
|
if (foldFrom && !sheepTypeId) {
|
||||||
isOnlySheepfold = true;
|
isOnlySheepfold = true;
|
||||||
} else if (!foldFrom && sheepTypeId) {
|
} else if (!foldFrom && sheepTypeId) {
|
||||||
@ -285,21 +309,22 @@ async function handleSheepFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isOnlySheepfold) {
|
if (isOnlySheepfold) {
|
||||||
await loadSheepBySheepfoldOnly(foldFrom);
|
await loadSheepBySheepfoldOnly(foldFrom, ranchId);
|
||||||
}
|
} else if (isOnlyTypeOrCombined) {
|
||||||
else if (isOnlyTypeOrCombined) {
|
|
||||||
form.value.manageTags = [];
|
form.value.manageTags = [];
|
||||||
let loadedSheep = [];
|
let loadedSheep = [];
|
||||||
|
|
||||||
if (foldFrom && sheepTypeId) {
|
if (foldFrom && sheepTypeId) {
|
||||||
loadedSheep = await loadSheepBySheepfoldAndType(foldFrom, sheepTypeId);
|
loadedSheep = await loadSheepBySheepfoldAndType(foldFrom, sheepTypeId, ranchId);
|
||||||
} else if (sheepTypeId) {
|
} else if (sheepTypeId) {
|
||||||
loadedSheep = await loadSheepByTypeOnly(sheepTypeId);
|
loadedSheep = await loadSheepByTypeOnly(sheepTypeId, ranchId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadedSheep.length > 0) {
|
if (loadedSheep.length > 0) {
|
||||||
form.value.manageTags = loadedSheep.map((sheep) => sheep.manageTags);
|
form.value.manageTags = loadedSheep.map((sheep) => sheep.manageTags);
|
||||||
await loadSheepInfo();
|
await loadSheepInfo();
|
||||||
|
} else {
|
||||||
|
proxy.$message.info("未查询到符合条件的耳号");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,24 +350,77 @@ function getSheepTypeList() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//加载所有牧场列表
|
||||||
|
function loadRanchList() {
|
||||||
|
listRanch().then(res => {
|
||||||
|
ranchOptions.value = res.rows.map(ranch => ({
|
||||||
|
id: ranch.id,
|
||||||
|
ranchName: ranch.ranch
|
||||||
|
}));
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('加载牧场列表失败', error);
|
||||||
|
proxy.$modal.msgError('获取牧场数据失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//切换牧场时触发
|
||||||
|
function handleRanchChange(ranchId) {
|
||||||
|
form.value.foldFrom = null;
|
||||||
|
form.value.foldTo = null;
|
||||||
|
|
||||||
|
if (!ranchId) {
|
||||||
|
currentRanchSheepfolds.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: '/sheepfold_management/sheepfold_management/list',
|
||||||
|
method: 'get',
|
||||||
|
params: { ranchId, pageNum: 1, pageSize: 9999 }
|
||||||
|
}).then(res => {
|
||||||
|
currentRanchSheepfolds.value = res.rows || [];
|
||||||
|
if (currentRanchSheepfolds.value.length === 0) {
|
||||||
|
proxy.$modal.msgWarning(`所选牧场(ID:${ranchId})暂无羊舍数据`);
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('加载牧场羊舍失败', error);
|
||||||
|
proxy.$modal.msgError('获取羊舍数据失败');
|
||||||
|
currentRanchSheepfolds.value = [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//只通过羊舍
|
//只通过羊舍
|
||||||
async function loadSheepBySheepfoldOnly(sheepfoldId) {
|
async function loadSheepBySheepfoldOnly(sheepfoldId, ranchId) {
|
||||||
|
if (!sheepfoldId || isNaN(Number(sheepfoldId))) {
|
||||||
|
proxy.$message.error('请选择有效的羊舍');
|
||||||
|
sheepOptions.value = [];
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!ranchId) {
|
||||||
|
proxy.$message.error('牧场信息异常,请重新选择');
|
||||||
|
sheepOptions.value = [];
|
||||||
|
return [];
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const res = await getSheepBySheepfoldId(String(sheepfoldId));
|
const res = await getSheepBySheepfoldId(Number(sheepfoldId));
|
||||||
const newSheepList = (res.data || []).map((sheep) => ({
|
const newSheepList = (res.data || []).map((sheep) => ({
|
||||||
id: sheep.id,
|
id: sheep.id,
|
||||||
manageTags: sheep.manageTags,
|
manageTags: sheep.manageTags || '未知耳号',
|
||||||
sheepfoldId: sheepfoldId,
|
sheepfoldId: Number(sheepfoldId),
|
||||||
}));
|
})).filter(item => item.manageTags);
|
||||||
|
|
||||||
const existingTags = new Set(sheepOptions.value.map((item) => item.manageTags));
|
if (newSheepList.length === 0) {
|
||||||
const mergedSheep = newSheepList.filter((item) => !existingTags.has(item.manageTags));
|
proxy.$message.info('当前羊舍下暂无羊只数据');
|
||||||
|
sheepOptions.value = [];
|
||||||
sheepOptions.value.push(...mergedSheep);
|
return [];
|
||||||
return mergedSheep;
|
}
|
||||||
|
sheepOptions.value = newSheepList;
|
||||||
|
return newSheepList;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('根据羊舍加载耳号失败', error);
|
console.error('根据羊舍加载耳号失败:', error);
|
||||||
proxy.$modal.msgError('加载羊舍耳号失败,请重试');
|
const errorMsg = error.response?.data?.msg || '加载羊舍耳号失败,请重试';
|
||||||
|
proxy.$modal.msgError(errorMsg);
|
||||||
|
sheepOptions.value = [];
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,47 +475,54 @@ async function loadSheepByTypeOnly(typeId) {
|
|||||||
|
|
||||||
//加载羊只信息
|
//加载羊只信息
|
||||||
async function loadSheepInfo() {
|
async function loadSheepInfo() {
|
||||||
const tags = form.value.manageTags;
|
const tags = form.value.manageTags;
|
||||||
if (!tags || tags.length === 0) return;
|
if (!tags || tags.length === 0) return;
|
||||||
|
|
||||||
const tagDetails = {};
|
const tagDetails = {};
|
||||||
const validResults = [];
|
const validResults = [];
|
||||||
let firstSheepfoldId = null;
|
let firstSheepfoldId = null;
|
||||||
|
let firstRanchId = null;
|
||||||
|
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
try {
|
try {
|
||||||
const { data: sheepData } = await checkSheepByManageTags(tag.trim());
|
const { data: sheepData } = await checkSheepByManageTags(tag.trim());
|
||||||
if (!sheepData) {
|
if (!sheepData) {
|
||||||
validResults.push(false);
|
validResults.push(false);
|
||||||
proxy.$modal.msgError(`耳号 ${tag} 不存在或信息异常`);
|
proxy.$modal.msgError(`耳号 ${tag} 不存在或信息异常`);
|
||||||
} else {
|
} else {
|
||||||
validResults.push(true);
|
validResults.push(true);
|
||||||
tagDetails[tag] = {
|
tagDetails[tag] = {
|
||||||
comment: sheepData.comment || '',
|
comment: sheepData.comment || '',
|
||||||
varietyId: sheepData.varietyId,
|
varietyId: sheepData.varietyId,
|
||||||
sheepId: sheepData.id,
|
sheepId: sheepData.id,
|
||||||
sheepfoldId: sheepData.sheepfoldId,
|
sheepfoldId: sheepData.sheepfoldId,
|
||||||
};
|
};
|
||||||
if (!firstSheepfoldId) {
|
if (!firstSheepfoldId) {
|
||||||
firstSheepfoldId = sheepData.sheepfoldId;
|
firstSheepfoldId = sheepData.sheepfoldId;
|
||||||
|
firstRanchId = sheepData.ranchId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取耳号信息失败:', error);
|
||||||
|
proxy.$modal.msgError(`耳号 ${tag} 验证失败,请重试`);
|
||||||
|
validResults.push(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取耳号信息失败:', error);
|
|
||||||
proxy.$modal.msgError(`耳号 ${tag} 验证失败,请重试`);
|
|
||||||
validResults.push(false);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (validResults.includes(false)) {
|
if (validResults.includes(false)) {
|
||||||
form.value.manageTags = tags.filter((_, index) => validResults[index]);
|
form.value.manageTags = tags.filter((_, index) => validResults[index]);
|
||||||
proxy.$message.warning('部分耳号不合法,已自动过滤');
|
proxy.$message.warning('部分耳号不合法,已自动过滤');
|
||||||
}
|
}
|
||||||
form.value.tagDetails = tagDetails;
|
form.value.tagDetails = tagDetails;
|
||||||
|
|
||||||
if (firstSheepfoldId && isAdd.value) {
|
if (firstRanchId && isAdd.value) {
|
||||||
form.value.foldFrom = Number(firstSheepfoldId);
|
form.value.ranchId = firstRanchId;
|
||||||
}
|
handleRanchChange(firstRanchId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstSheepfoldId && isAdd.value) {
|
||||||
|
form.value.foldFrom = Number(firstSheepfoldId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消按钮
|
//取消按钮
|
||||||
@ -507,16 +592,10 @@ async function handleUpdate(row) {
|
|||||||
isEdit: true
|
isEdit: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// 5. 验证匹配情况(调试用)
|
|
||||||
// const foldFromItem = sheepfoldOptions.value.find(item => item.id === formData.foldFrom);
|
|
||||||
// const foldToItem = sheepfoldOptions.value.find(item => item.id === formData.foldTo);
|
|
||||||
// const sheepTypeItem = sheepTypeOptions.value.find(item => item.id === formData.sheepTypeId);
|
|
||||||
// console.log("转出羊舍匹配结果:", foldFromItem ? foldFromItem.sheepfoldName : "未找到");
|
|
||||||
// console.log("转入羊舍匹配结果:", foldToItem ? foldToItem.sheepfoldName : "未找到");
|
|
||||||
// console.log("羊只类型匹配结果:", sheepTypeItem ? sheepTypeItem.name : "未找到");
|
|
||||||
|
|
||||||
form.value = formData;
|
form.value = formData;
|
||||||
|
form.value.ranchId = row.ranchId;
|
||||||
|
handleRanchChange(row.ranchId);
|
||||||
|
isAdd.value = false;
|
||||||
if (manageTags.length > 0) {
|
if (manageTags.length > 0) {
|
||||||
await loadSheepInfo();
|
await loadSheepInfo();
|
||||||
}
|
}
|
||||||
@ -622,6 +701,7 @@ function handleApproveReject() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//加载羊舍数据
|
||||||
function loadSheepfold() {
|
function loadSheepfold() {
|
||||||
listSheepfold({ pageNum: 1, pageSize: 9999 }).then((res) => {
|
listSheepfold({ pageNum: 1, pageSize: 9999 }).then((res) => {
|
||||||
sheepfoldOptions.value = res.rows;
|
sheepfoldOptions.value = res.rows;
|
||||||
@ -632,6 +712,7 @@ function loadSheepfold() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取品种数据
|
||||||
function getVarietyOptions() {
|
function getVarietyOptions() {
|
||||||
request({
|
request({
|
||||||
url: '/base/variety/list',
|
url: '/base/variety/list',
|
||||||
@ -644,6 +725,7 @@ function getVarietyOptions() {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadSheepfold();
|
loadSheepfold();
|
||||||
|
loadRanchList();
|
||||||
getVarietyOptions();
|
getVarietyOptions();
|
||||||
getSheepTypeList();
|
getSheepTypeList();
|
||||||
getList();
|
getList();
|
||||||
|
@ -374,7 +374,7 @@ async function loadSheepInfo() {
|
|||||||
const { data: sheepData } = await checkSheepByManageTags(tag.trim());
|
const { data: sheepData } = await checkSheepByManageTags(tag.trim());
|
||||||
if (!sheepData) {
|
if (!sheepData) {
|
||||||
validResults.push(false);
|
validResults.push(false);
|
||||||
proxy.$modal.msgError(`耳号 ${tag} 不存在`);
|
proxy.$modal.msgError(`耳号 ${tag} 不存在或已删除`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
537
src/views/sheep_death/death/index.vue
Normal file
537
src/views/sheep_death/death/index.vue
Normal file
@ -0,0 +1,537 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
<el-form-item label="管理耳号" prop="manageTags">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.manageTags"
|
||||||
|
placeholder="请输入管理耳号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品种" prop="variety">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.variety"
|
||||||
|
placeholder="请输入品种"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="事件类型" prop="eventType">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.eventType"
|
||||||
|
placeholder="请输入事件类型"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="死亡日期" prop="deathDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.deathDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择死亡日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
|
||||||
|
<el-option label="公" value="1" />
|
||||||
|
<el-option label="母" value="0" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="死淘去向" prop="disposalDirection">
|
||||||
|
<el-select v-model="queryParams.disposalDirection" placeholder="请选择死淘去向" clearable>
|
||||||
|
<el-option label="深埋" value="深埋" />
|
||||||
|
<el-option label="无害化" value="无害化" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.technician"
|
||||||
|
placeholder="请输入技术员"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理人" prop="handler">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.handler"
|
||||||
|
placeholder="请输入处理人"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="班组" prop="workGroup">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.workGroup"
|
||||||
|
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="['sheep_death:death:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['sheep_death:death:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['sheep_death:death:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['sheep_death:death:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="deathList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="主键ID" align="center" prop="id" width="80" />
|
||||||
|
<el-table-column label="管理耳号" align="center" prop="manageTags" width="120" />
|
||||||
|
<el-table-column label="品种" align="center" prop="variety" width="100" />
|
||||||
|
<el-table-column label="事件类型" align="center" prop="eventType" width="100" />
|
||||||
|
<el-table-column label="死亡日期" align="center" prop="deathDate" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.deathDate, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="死亡时羊只类别" align="center" prop="sheepType" width="130" />
|
||||||
|
<el-table-column label="性别" align="center" prop="gender" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.gender === 1 ? '公' : scope.row.gender === 0 ? '母' : '' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="日龄" align="center" prop="dayAge" width="80" />
|
||||||
|
<el-table-column label="胎次" align="center" prop="parity" width="80" />
|
||||||
|
<el-table-column label="疾病类型ID" align="center" prop="diseaseTypeId" width="120" />
|
||||||
|
<el-table-column label="疾病子类型ID" align="center" prop="diseaseSubtypeId" width="130" />
|
||||||
|
<el-table-column label="死淘去向" align="center" prop="disposalDirection" width="100" />
|
||||||
|
<el-table-column label="技术员" align="center" prop="technician" width="100" />
|
||||||
|
<el-table-column label="处理人" align="center" prop="handler" width="100" />
|
||||||
|
<el-table-column label="羊舍" align="center" prop="sheepfoldName" width="120" />
|
||||||
|
<el-table-column label="班组" align="center" prop="workGroup" width="100" />
|
||||||
|
<el-table-column label="繁育状态" align="center" prop="breedStatus" width="100" />
|
||||||
|
<el-table-column label="死亡时产后天数" align="center" prop="postLambingDay" width="130" />
|
||||||
|
<el-table-column label="死亡时泌乳天数" align="center" prop="lactationDay" width="130" />
|
||||||
|
<el-table-column label="死亡时怀孕天数" align="center" prop="gestationDay" width="130" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" width="100" />
|
||||||
|
<el-table-column label="创建日期" align="center" prop="createTime" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="comment" width="150" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['sheep_death:death:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['sheep_death:death: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="800px" append-to-body>
|
||||||
|
<el-form ref="deathRef" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="管理耳号" prop="manageTags">
|
||||||
|
<el-input v-model="form.manageTags" placeholder="请输入管理耳号" @blur="handleEarTagBlur" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="事件类型" prop="eventType">
|
||||||
|
<el-input v-model="form.eventType" placeholder="事件类型" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="品种" prop="variety">
|
||||||
|
<el-input v-model="form.variety" placeholder="品种" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="死亡时羊只类别" prop="sheepType">
|
||||||
|
<el-input v-model="form.sheepType" placeholder="羊只类别" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-select v-model="form.gender" placeholder="请选择性别" disabled>
|
||||||
|
<el-option label="公" :value="1" />
|
||||||
|
<el-option label="母" :value="0" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="日龄" prop="dayAge">
|
||||||
|
<el-input-number v-model="form.dayAge" placeholder="日龄" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="胎次" prop="parity">
|
||||||
|
<el-input-number v-model="form.parity" placeholder="胎次" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="羊舍" prop="sheepfoldName">
|
||||||
|
<el-input v-model="form.sheepfoldName" placeholder="羊舍" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="繁育状态" prop="breedStatus">
|
||||||
|
<el-input v-model="form.breedStatus" placeholder="繁育状态" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="死亡日期" prop="deathDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.deathDate"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择死亡日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="死亡时产后天数" prop="postLambingDay">
|
||||||
|
<el-input-number v-model="form.postLambingDay" placeholder="产后天数" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="死亡时泌乳天数" prop="lactationDay">
|
||||||
|
<el-input-number v-model="form.lactationDay" placeholder="泌乳天数" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="死亡时怀孕天数" prop="gestationDay">
|
||||||
|
<el-input-number v-model="form.gestationDay" placeholder="怀孕天数" :min="0" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="疾病类型ID" prop="diseaseTypeId">
|
||||||
|
<el-input-number v-model="form.diseaseTypeId" placeholder="请输入疾病类型ID" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="疾病子类型ID" prop="diseaseSubtypeId">
|
||||||
|
<el-input-number v-model="form.diseaseSubtypeId" placeholder="请输入疾病子类型ID" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="死淘去向" prop="disposalDirection">
|
||||||
|
<el-select v-model="form.disposalDirection" placeholder="请选择死淘去向">
|
||||||
|
<el-option label="深埋" value="深埋" />
|
||||||
|
<el-option label="无害化" value="无害化" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="处理人" prop="handler">
|
||||||
|
<el-input v-model="form.handler" placeholder="请输入处理人" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="班组" prop="workGroup">
|
||||||
|
<el-input v-model="form.workGroup" placeholder="请输入班组" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</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="Death">
|
||||||
|
import { listDeath, getDeath, delDeath, addDeath, updateDeath, getSheepInfo } from "@/api/sheep_death/death"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const deathList = 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,
|
||||||
|
manageTags: null,
|
||||||
|
variety: null,
|
||||||
|
eventType: null,
|
||||||
|
deathDate: null,
|
||||||
|
sheepType: null,
|
||||||
|
gender: null,
|
||||||
|
dayAge: null,
|
||||||
|
parity: null,
|
||||||
|
diseaseTypeId: null,
|
||||||
|
diseaseSubtypeId: null,
|
||||||
|
disposalDirection: null,
|
||||||
|
technician: null,
|
||||||
|
handler: null,
|
||||||
|
sheepfoldName: null,
|
||||||
|
workGroup: null,
|
||||||
|
breedStatus: null,
|
||||||
|
postLambingDay: null,
|
||||||
|
lactationDay: null,
|
||||||
|
gestationDay: null,
|
||||||
|
comment: null,
|
||||||
|
isDelete: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
manageTags: [
|
||||||
|
{ required: true, message: "管理耳号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
deathDate: [
|
||||||
|
{ required: true, message: "死亡日期不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询羊只死淘记录列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listDeath(queryParams.value).then(response => {
|
||||||
|
deathList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
sheepId: null,
|
||||||
|
manageTags: null,
|
||||||
|
variety: null,
|
||||||
|
eventType: "死亡",
|
||||||
|
deathDate: new Date().toISOString().split('T')[0],
|
||||||
|
sheepType: null,
|
||||||
|
gender: null,
|
||||||
|
dayAge: null,
|
||||||
|
parity: null,
|
||||||
|
diseaseTypeId: null,
|
||||||
|
diseaseSubtypeId: null,
|
||||||
|
disposalDirection: null,
|
||||||
|
technician: null,
|
||||||
|
handler: null,
|
||||||
|
sheepfoldName: null,
|
||||||
|
workGroup: null,
|
||||||
|
breedStatus: null,
|
||||||
|
postLambingDay: null,
|
||||||
|
lactationDay: null,
|
||||||
|
gestationDay: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
comment: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
isDelete: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("deathRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 管理耳号失去焦点事件 */
|
||||||
|
function handleEarTagBlur() {
|
||||||
|
if (form.value.manageTags && form.value.manageTags.trim()) {
|
||||||
|
getSheepInfo(form.value.manageTags.trim()).then(response => {
|
||||||
|
if (response.code === 200 && response.data) {
|
||||||
|
const sheepData = response.data
|
||||||
|
form.value.sheepId = sheepData.sheepId
|
||||||
|
form.value.variety = sheepData.variety
|
||||||
|
form.value.sheepType = sheepData.sheepType
|
||||||
|
form.value.gender = sheepData.gender
|
||||||
|
form.value.dayAge = sheepData.dayAge
|
||||||
|
form.value.parity = sheepData.parity
|
||||||
|
form.value.sheepfoldName = sheepData.sheepfoldName
|
||||||
|
form.value.breedStatus = sheepData.breedStatus
|
||||||
|
form.value.postLambingDay = sheepData.postLambingDay
|
||||||
|
form.value.lactationDay = sheepData.lactationDay
|
||||||
|
form.value.gestationDay = sheepData.gestationDay
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgWarning("未找到该耳号对应的羊只信息")
|
||||||
|
// 清空自动填充的字段
|
||||||
|
form.value.sheepId = null
|
||||||
|
form.value.variety = null
|
||||||
|
form.value.sheepType = null
|
||||||
|
form.value.gender = null
|
||||||
|
form.value.dayAge = null
|
||||||
|
form.value.parity = null
|
||||||
|
form.value.sheepfoldName = null
|
||||||
|
form.value.breedStatus = null
|
||||||
|
form.value.postLambingDay = null
|
||||||
|
form.value.lactationDay = null
|
||||||
|
form.value.gestationDay = null
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
proxy.$modal.msgError("查询羊只信息失败")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加羊只死淘记录"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getDeath(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改羊只死淘记录"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["deathRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateDeath(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addDeath(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除羊只死淘记录编号为"' + _ids + '"的数据项?').then(function() {
|
||||||
|
return delDeath(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('sheep_death/death/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `death_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
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 { defineConfig, loadEnv } from 'vite'
|
||||||
import createVitePlugins from './vite/plugins'
|
import createVitePlugins from './vite/plugins'
|
||||||
|
|
||||||
const baseUrl = 'http://localhost:8080' // 后端接口
|
const baseUrl = 'http://127.0.0.1:8080' // 后端接口
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode, command }) => {
|
export default defineConfig(({ mode, command }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user