Merge branch 'main' of http://e19510c831.iok.la/admin/zhyc-sheep-ui
This commit is contained in:
commit
12dde3b9c4
@ -22,7 +22,7 @@
|
|||||||
"axios": "0.28.1",
|
"axios": "0.28.1",
|
||||||
"clipboard": "2.0.11",
|
"clipboard": "2.0.11",
|
||||||
"echarts": "5.5.1",
|
"echarts": "5.5.1",
|
||||||
"element-plus": "2.7.6",
|
"element-plus": "^2.7.6",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "6.6.2",
|
"fuse.js": "6.6.2",
|
||||||
"js-beautify": "1.14.11",
|
"js-beautify": "1.14.11",
|
||||||
|
44
src/api/biosafety/prescription.js
Normal file
44
src/api/biosafety/prescription.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询处方列表
|
||||||
|
export function listPrescription(query) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/prescription/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询处方详细
|
||||||
|
export function getPrescription(id) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/prescription/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增处方
|
||||||
|
export function addPrescription(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/prescription',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改处方
|
||||||
|
export function updatePrescription(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/prescription',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除处方
|
||||||
|
export function delPrescription(id) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/prescription/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
44
src/api/biosafety/unit.js
Normal file
44
src/api/biosafety/unit.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询药品单位列表
|
||||||
|
export function listUnit(query) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/unit/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询药品单位详细
|
||||||
|
export function getUnit(id) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/unit/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增药品单位
|
||||||
|
export function addUnit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/unit',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改药品单位
|
||||||
|
export function updateUnit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/unit',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除药品单位
|
||||||
|
export function delUnit(id) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/unit/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
44
src/api/biosafety/usageInfo.js
Normal file
44
src/api/biosafety/usageInfo.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询药品使用记录列表
|
||||||
|
export function listUsageInfo(query) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/usageInfo/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询药品使用记录详细
|
||||||
|
export function getUsageInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/usageInfo/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增药品使用记录
|
||||||
|
export function addUsageInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/usageInfo',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改药品使用记录
|
||||||
|
export function updateUsageInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/usageInfo',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除药品使用记录
|
||||||
|
export function delUsageInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: '/biosafety/usageInfo/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
46
src/api/dryMatterCorrection/dryMatterCorrection.js
Normal file
46
src/api/dryMatterCorrection/dryMatterCorrection.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询干物质校正列表
|
||||||
|
export function listDryMatterCorrection(query) {
|
||||||
|
return request({
|
||||||
|
url: '/dryMatterCorrection/dryMatterCorrection/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
datetime: query.datetime // 只传递年月参数
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询干物质校正详细
|
||||||
|
export function getDryMatterCorrection(id) {
|
||||||
|
return request({
|
||||||
|
url: '/dryMatterCorrection/dryMatterCorrection/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增干物质校正
|
||||||
|
export function addDryMatterCorrection(data) {
|
||||||
|
return request({
|
||||||
|
url: '/dryMatterCorrection/dryMatterCorrection',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改干物质校正
|
||||||
|
export function updateDryMatterCorrection(data) {
|
||||||
|
return request({
|
||||||
|
url: '/dryMatterCorrection/dryMatterCorrection',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除干物质校正
|
||||||
|
export function delDryMatterCorrection(id) {
|
||||||
|
return request({
|
||||||
|
url: '/dryMatterCorrection/dryMatterCorrection/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
20
src/api/produce/manage_sheep/add_sheep/add_sheep.js
Normal file
20
src/api/produce/manage_sheep/add_sheep/add_sheep.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
// 新增羊只
|
||||||
|
export function addSheep(data) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/add_sheep',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出模板
|
||||||
|
export function exportSheepForm(data) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/add_sheep/exportForm',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
}
|
44
src/api/produce/manage_sheep/trans_group/trans_group.js
Normal file
44
src/api/produce/manage_sheep/trans_group/trans_group.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询转群记录列表
|
||||||
|
export function listTrans_group(query) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/trans_group/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询转群记录详细
|
||||||
|
export function getTrans_group(id) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/trans_group/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增转群记录
|
||||||
|
export function addTrans_group(data) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/trans_group',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改转群记录
|
||||||
|
export function updateTrans_group(data) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/trans_group',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除转群记录
|
||||||
|
export function delTrans_group(id) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/manage_sheep/trans_group/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询转场列表
|
||||||
|
export function listTransition_info(query) {
|
||||||
|
return request({
|
||||||
|
url: 'produce/manage_sheep/transition_info/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询转场详细
|
||||||
|
export function getTransition_info(id) {
|
||||||
|
return request({
|
||||||
|
url: 'produce/manage_sheep/transition_info/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增转场
|
||||||
|
export function addTransition_info(data) {
|
||||||
|
return request({
|
||||||
|
url: 'produce/manage_sheep/transition_info',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改转场
|
||||||
|
export function updateTransition_info(data) {
|
||||||
|
return request({
|
||||||
|
url: 'produce/manage_sheep/transition_info',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除转场
|
||||||
|
export function delTransition_info(id) {
|
||||||
|
return request({
|
||||||
|
url: 'produce/manage_sheep/transition_info/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||||||
// 查询去势列表
|
// 查询去势列表
|
||||||
export function listCastrate(query) {
|
export function listCastrate(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/castrate/list',
|
url: '/produce/other/castrate/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
@ -12,7 +12,7 @@ export function listCastrate(query) {
|
|||||||
// 查询去势详细
|
// 查询去势详细
|
||||||
export function getCastrate(id) {
|
export function getCastrate(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/castrate/' + id,
|
url: '/produce/other/castrate/' + id,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ export function getCastrate(id) {
|
|||||||
// 新增去势
|
// 新增去势
|
||||||
export function addCastrate(data) {
|
export function addCastrate(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/castrate',
|
url: '/produce/other/castrate',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@ -29,7 +29,7 @@ export function addCastrate(data) {
|
|||||||
// 修改去势
|
// 修改去势
|
||||||
export function updateCastrate(data) {
|
export function updateCastrate(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/castrate',
|
url: '/produce/other/castrate',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@ -38,7 +38,7 @@ export function updateCastrate(data) {
|
|||||||
// 删除去势
|
// 删除去势
|
||||||
export function delCastrate(id) {
|
export function delCastrate(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/produce/castrate/' + id,
|
url: '/produce/other/castrate/' + id,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
93
src/api/produce/other/fixHoof/fixHoof.js
Normal file
93
src/api/produce/other/fixHoof/fixHoof.js
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
// import request from '@/utils/request'
|
||||||
|
|
||||||
|
// // 查询修蹄列表
|
||||||
|
// export function listFixHoof(query) {
|
||||||
|
// return request({
|
||||||
|
// url: '/produce/other/fixHoof/list',
|
||||||
|
// method: 'get',
|
||||||
|
// params: query
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 查询修蹄详细
|
||||||
|
// export function getFixHoof(id) {
|
||||||
|
// return request({
|
||||||
|
// url: '/produce/other/fixHoof' + id,
|
||||||
|
// method: 'get'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 新增修蹄
|
||||||
|
// export function addFixHoof(data) {
|
||||||
|
// return request({
|
||||||
|
// url: '/produce/other/fixHoof',
|
||||||
|
// method: 'post',
|
||||||
|
// data: data
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 修改修蹄
|
||||||
|
// export function updateFixHoof(data) {
|
||||||
|
// return request({
|
||||||
|
// url: '/produce/other/fixHoof/',
|
||||||
|
// method: 'put',
|
||||||
|
// data: data
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 删除修蹄
|
||||||
|
// export function delFixHoof(id) {
|
||||||
|
// return request({
|
||||||
|
// url: '/produce/other/fixHoof/' + id,
|
||||||
|
// method: 'delete'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// fixHoof.js
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 查询修蹄列表
|
||||||
|
export function listFixHoof(query) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/other/fixHoof/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 查询修蹄详细
|
||||||
|
export function getFixHoof(id) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/other/fixHoof/${id}',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 新增修蹄
|
||||||
|
export function addFixHoof(data) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/other/fixHoof',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 修改修蹄
|
||||||
|
export function updateFixHoof(data) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/other/fixHoof',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除修蹄
|
||||||
|
export function delFixHoof(ids) {
|
||||||
|
return request({
|
||||||
|
url: `/produce/other/fixHoof/${ids.join(',')}`,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//导出
|
||||||
|
export function exportFixHoof(query) {
|
||||||
|
return request({
|
||||||
|
url: '/produce/other/fixHoof/export',
|
||||||
|
method: 'post',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob' // 导出功能需要设置响应类型为blob
|
||||||
|
})
|
||||||
|
}
|
@ -45,5 +45,5 @@ export default {
|
|||||||
* The default is only used in the production env
|
* The default is only used in the production env
|
||||||
* If you want to also use it in dev, you can pass ['production', 'development']
|
* If you want to also use it in dev, you can pass ['production', 'development']
|
||||||
*/
|
*/
|
||||||
errorLog: 'production'
|
errorLog: 'production',
|
||||||
}
|
}
|
||||||
|
187
src/views/biosafety/medicine/unit.vue
Normal file
187
src/views/biosafety/medicine/unit.vue
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
|
v-hasPermi="['biosafety:unit:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
|
v-hasPermi="['biosafety:unit:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['biosafety:unit:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="单位" align="center" prop="name" />
|
||||||
|
<el-table-column label="国际单位" align="center" prop="unit" />
|
||||||
|
<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="['biosafety:unit:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['biosafety:unit: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="unitRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="单位" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入单位" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="国际单位" prop="name">
|
||||||
|
<el-input v-model="form.unit" 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="Unit">
|
||||||
|
import { listUnit, getUnit, delUnit, addUnit, updateUnit } from "@/api/biosafety/unit"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const unitList = 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,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询药品单位列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listUnit(queryParams.value).then(response => {
|
||||||
|
unitList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
name: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("unitRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
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
|
||||||
|
getUnit(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改药品单位"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["unitRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateUnit(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addUnit(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 delUnit(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('biosafety/unit/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `unit_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
513
src/views/biosafety/prescription/index.vue
Normal file
513
src/views/biosafety/prescription/index.vue
Normal file
@ -0,0 +1,513 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="处方编号" prop="no">
|
||||||
|
<el-input v-model="queryParams.no" placeholder="请输入处方编号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处方名称" prop="name">
|
||||||
|
<el-input v-model="queryParams.name" placeholder="请输入处方名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类型" prop="persType">
|
||||||
|
<el-select v-model="queryParams.persType" placeholder="请选择类型" clearable style="width: 150px">
|
||||||
|
<el-option v-for="dict in pres_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 150px">
|
||||||
|
<el-option v-for="dict in pres_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 按钮组 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
|
</el-col> -->
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="prescriptionList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="处方编号" align="center" prop="no" />
|
||||||
|
<el-table-column label="处方名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="类型" align="center" prop="persType">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="pres_type" :value="scope.row.persType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="pres_status" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||||
|
<el-button link :type="scope.row.status ? 'warning' : 'primary'" @click="handleStatus(scope.row)">{{ scope.row.status?"禁用":"启用" }}</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</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="60%" append-to-body s>
|
||||||
|
<!-- 详情页:只读展示 -->
|
||||||
|
<div v-if="isView" style="padding-bottom:20px ;">
|
||||||
|
<el-descriptions :column="2" border>
|
||||||
|
<el-descriptions-item label="处方编号">{{ form.no }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="处方名称">{{ form.name }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="类型">
|
||||||
|
<dict-tag :options="pres_type" :value="form.persType" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="状态">
|
||||||
|
<dict-tag :options="pres_status" :value="form.status" />
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注" :span="2">
|
||||||
|
{{ form.comment || '无' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<el-divider content-position="left">处方详情</el-divider>
|
||||||
|
|
||||||
|
<el-table :data="swPresDetailList" stripe border style="width: 100%" max-height="300">
|
||||||
|
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||||
|
<el-table-column label="药品" prop="mediId" align="center" :formatter="formatMedicine" />
|
||||||
|
<el-table-column label="用量" prop="dosage" />
|
||||||
|
<el-table-column label="使用方法" align="center" prop="usageId" :formatter="formatUsage" />
|
||||||
|
<el-table-column label="单位" prop="unitId" align="center" :formatter="formatUnit" />
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 修改页:可编辑表单 -->
|
||||||
|
<div v-else>
|
||||||
|
<el-form ref="prescriptionRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="处方编号" prop="no">
|
||||||
|
<el-input v-model="form.no" placeholder="请输入处方编号" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="处方名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入处方名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="类型" prop="persType">
|
||||||
|
<el-select v-model="form.persType" placeholder="请选择类型" style="width: 100%">
|
||||||
|
<el-option v-for="dict in pres_type" :key="dict.value" :label="dict.label"
|
||||||
|
:value="parseInt(dict.value)" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="form.status" placeholder="请选择状态" style="width: 100%">
|
||||||
|
<el-option v-for="dict in pres_status" :key="dict.value" :label="dict.label"
|
||||||
|
:value="parseInt(dict.value)" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input type="textarea" :rows="2" v-model="form.comment" 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="handleAddSwPresDetail()">添加</el-button>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table :data="swPresDetailList" :row-class-name="rowSwPresDetailIndex"
|
||||||
|
@selection-change="handleSwPresDetailSelectionChange" ref="swPresDetail" border stripe>
|
||||||
|
<el-table-column label="序号" align="center" prop="index" width="60" />
|
||||||
|
<el-table-column label="药品" prop="mediId">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-select v-model="scope.row.mediId" filterable placeholder="请选择药品" style="width: 100%">
|
||||||
|
<el-option v-for="item in medicines" :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.dosage" placeholder="请输入用量" :min="0" :precision="1"
|
||||||
|
controls-position="right" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="单位" prop="unitId">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-select v-model="scope.row.unitId" placeholder="请选择单位">
|
||||||
|
<el-option v-for="item in units" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="使用方法" prop="usageId">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-select v-model="scope.row.usageId" placeholder="请选择使用方法">
|
||||||
|
<el-option v-for="item in usages" :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="deletePresDetail(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="submitForm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Prescription">
|
||||||
|
import { listPrescription, getPrescription, delPrescription, addPrescription, updatePrescription } from "@/api/biosafety/prescription"
|
||||||
|
import { getCurrentInstance, ref, reactive, toRefs } from 'vue'
|
||||||
|
import { listUnit } from "@/api/biosafety/unit"
|
||||||
|
import { listUsage } from "@/api/biosafety/usage"
|
||||||
|
import { listMedicine } from "@/api/biosafety/medicine"
|
||||||
|
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { pres_status, pres_type } = proxy.useDict('pres_status', 'pres_type')
|
||||||
|
|
||||||
|
const prescriptionList = ref([]) // 主表数据
|
||||||
|
const swPresDetailList = ref([]) // 子表(处方详情)数据
|
||||||
|
const open = ref(false) // 弹窗显隐
|
||||||
|
const loading = ref(true) // 列表加载状态
|
||||||
|
const showSearch = ref(true) // 搜索栏显隐
|
||||||
|
const ids = ref([]) // 主表选中的 id 数组
|
||||||
|
const checkedSwPresDetail = ref([]) // 子表选中的行序号数组
|
||||||
|
const single = ref(true) // 是否仅选一条(控制“修改”按钮禁用)
|
||||||
|
const multiple = ref(true) // 是否至少选一条(控制“删除”按钮禁用)
|
||||||
|
const total = ref(0) // 总条数
|
||||||
|
const title = ref("") // 弹窗标题
|
||||||
|
const isView = ref(false) // 当前弹窗是否为“查看详情”模式
|
||||||
|
|
||||||
|
/* 响应式数据:form、queryParams、rules */
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
no: null,
|
||||||
|
name: null,
|
||||||
|
persType: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
rules: {}
|
||||||
|
})
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
const units = ref([]) // 单位下拉选项
|
||||||
|
const usages = ref([]) // 使用方法下拉选项
|
||||||
|
const medicines = ref([]) // 药品下拉选项
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取药品下拉数据源
|
||||||
|
* 将返回数据转换成 { value, label } 结构,供 el-option 使用
|
||||||
|
*/
|
||||||
|
function getMedicines() {
|
||||||
|
listMedicine().then(response => {
|
||||||
|
medicines.value = response.rows.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取单位下拉数据源(单位字典)
|
||||||
|
* 将返回数据转换成 { value, label } 结构,供 el-option 使用
|
||||||
|
*/
|
||||||
|
function getUnit() {
|
||||||
|
listUnit().then(response => {
|
||||||
|
units.value = response.rows.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取处方使用方法下拉数据源
|
||||||
|
* 将返回数据转换成 { value, label } 结构,供 el-option 使用
|
||||||
|
*/
|
||||||
|
function getUsageOptions() {
|
||||||
|
listUsage().then(response => {
|
||||||
|
usages.value = response.rows.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化使用方法
|
||||||
|
* 根据 usageId 查找对应的使用方法名称
|
||||||
|
*/
|
||||||
|
function formatUsage(row) {
|
||||||
|
const usage = usages.value.find(item => item.value === row.usageId)
|
||||||
|
return usage ? usage.label : '未知'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 格式化药品
|
||||||
|
* 根据 mediId 查找对应的药品名称
|
||||||
|
*/
|
||||||
|
function formatMedicine(row) {
|
||||||
|
const medicine = medicines.value.find(item => item.value === row.mediId)
|
||||||
|
return medicine ? medicine.label : '未知'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 格式化单位
|
||||||
|
* 根据 unitId 查找对应的单位名称
|
||||||
|
*/
|
||||||
|
function formatUnit(row) {
|
||||||
|
const unit = units.value.find(item => item.value === row.unitId)
|
||||||
|
return unit ? unit.label : '未知'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询处方列表
|
||||||
|
* loading 状态开始时置 true,接口返回后更新列表数据与总数,loading 置 false
|
||||||
|
*/
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listPrescription(queryParams.value).then(response => {
|
||||||
|
prescriptionList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单/子表重置
|
||||||
|
* 将 form、swPresDetailList 重置为初始状态,并清空校验提示
|
||||||
|
*/
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
no: null,
|
||||||
|
name: null,
|
||||||
|
persType: null,
|
||||||
|
comment: null,
|
||||||
|
status: null
|
||||||
|
}
|
||||||
|
swPresDetailList.value = []
|
||||||
|
proxy.resetForm("prescriptionRef")
|
||||||
|
isView.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索按钮
|
||||||
|
* 将分页重置到第一页后重新拉取数据
|
||||||
|
*/
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置搜索条件
|
||||||
|
* 清空 queryRef 表单后重新触发查询
|
||||||
|
*/
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主表多选回调
|
||||||
|
* 更新 ids 数组,并设置 single / multiple 按钮禁用状态
|
||||||
|
*/
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
single.value = selection.length !== 1 // 只有一条时才允许“修改”
|
||||||
|
multiple.value = !selection.length // 至少一条时才允许“删除”
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增按钮
|
||||||
|
* 重置表单、打开弹窗、设置标题为“添加处方”
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
form.value.no = `P${Date.now()}` // 自动生成处方编号
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加处方"
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看详情
|
||||||
|
* 根据 id 拉取单条记录及子表数据,弹窗只读展示
|
||||||
|
*/
|
||||||
|
function handleView(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getPrescription(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
swPresDetailList.value = response.data.swPresDetailList
|
||||||
|
open.value = true
|
||||||
|
title.value = "处方详情"
|
||||||
|
isView.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改按钮
|
||||||
|
* 与查看详情共用接口,但弹窗可编辑
|
||||||
|
*/
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
getPrescription(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
swPresDetailList.value = response.data.swPresDetailList
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改处方"
|
||||||
|
isView.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 提交按钮
|
||||||
|
function handleStatus(row) {
|
||||||
|
const _id = row.id || ids.value
|
||||||
|
|
||||||
|
const newStatus = row.status ? 0 : 1 // 切换状态
|
||||||
|
proxy.$modal.confirm(`是否确认将 ${row.name }处方${row.status ? '禁用' : '启用'}?`).then(() => {
|
||||||
|
return updatePrescription({ id: _id, status: newStatus })
|
||||||
|
}).then(() => {
|
||||||
|
proxy.$modal.msgSuccess(`处方${row.status ? '禁用' : '启用'}成功`)
|
||||||
|
getList() // 刷新列表
|
||||||
|
}).catch(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交表单(新增/修改)
|
||||||
|
* 先校验,再把子表数据合并到 form 中,最后根据 id 判断是新增还是更新
|
||||||
|
*/
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["prescriptionRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
form.value.swPresDetailList = swPresDetailList.value
|
||||||
|
if (form.value.id) {
|
||||||
|
updatePrescription(form.value).then(() => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addPrescription(form.value).then(() => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除按钮(单条/批量)
|
||||||
|
* 弹出确认框后调用接口删除,成功后刷新列表
|
||||||
|
*/
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm(`是否确认删除处方编号为"${_ids}"的数据项?`).then(() => {
|
||||||
|
return delPrescription(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子表行序号计算
|
||||||
|
* 通过 el-table 的 row-class-name 钩子给每一行写入 index(从 1 开始)
|
||||||
|
*/
|
||||||
|
function rowSwPresDetailIndex({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子表“添加”按钮
|
||||||
|
* 往 swPresDetailList 追加一条空记录
|
||||||
|
*/
|
||||||
|
function handleAddSwPresDetail() {
|
||||||
|
swPresDetailList.value.push({ mediId: '', dosage: '', unitId: '', usageId: '' })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子表“删除”按钮
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function deletePresDetail(row) {
|
||||||
|
const index = swPresDetailList.value.findIndex(item => item.index === row.index)
|
||||||
|
if (index !== -1) {
|
||||||
|
swPresDetailList.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 子表多选回调
|
||||||
|
* 记录被选中的行序号数组
|
||||||
|
*/
|
||||||
|
function handleSwPresDetailSelectionChange(selection) {
|
||||||
|
checkedSwPresDetail.value = selection.map(item => item.index)
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出按钮
|
||||||
|
* 调用后端通用导出接口,文件名带时间戳
|
||||||
|
*/
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('biosafety/prescription/export', { ...queryParams.value }, `prescription_${Date.now()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化:加载列表
|
||||||
|
getList()
|
||||||
|
getUnit() // 获取单位下拉数据源
|
||||||
|
getUsageOptions() // 获取使用方法下拉数据源
|
||||||
|
getMedicines() // 获取药品下拉数据源
|
||||||
|
</script>
|
298
src/views/biosafety/usageInfo/index.vue
Normal file
298
src/views/biosafety/usageInfo/index.vue
Normal file
@ -0,0 +1,298 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="使用名称" prop="name">
|
||||||
|
<el-input v-model="queryParams.name" placeholder="请输入使用名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="使用类型" prop="useType">
|
||||||
|
<el-select v-model="queryParams.useType" placeholder="请选择使用类型" clearable style="width: 180px">
|
||||||
|
<el-option v-for="dict in pres_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="使用时间" style="width: 308px">
|
||||||
|
<el-date-picker v-model="daterangeCreateTime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||||
|
start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-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="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['biosafety:usage:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<el-table v-loading="loading" :data="usageList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column label="使用名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="使用类型" align="center" prop="useType">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="pres_type" :value="scope.row.useType" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="使用时间" align="center" prop="createTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</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="View" @click="handleDetail(scope.row)"
|
||||||
|
v-hasPermi="['biosafety:usage:query']">详情</el-button>
|
||||||
|
<!-- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['biosafety:usage: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="680px" top="8vh" append-to-body :close-on-click-modal="false"
|
||||||
|
class="usage-detail-dialog">
|
||||||
|
<!-- 基础信息 -->
|
||||||
|
<el-card shadow="never" class="detail-card">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<el-icon>
|
||||||
|
<Document />
|
||||||
|
</el-icon> 基本信息
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-descriptions :column="2" border>
|
||||||
|
<el-descriptions-item label="使用名称">
|
||||||
|
{{ form.name }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="使用类型">
|
||||||
|
<el-tag size="small" :type="form.useType === 1 ? 'primary' : 'success'">
|
||||||
|
{{pres_type.find(it => it.value === form.useType)?.label || ''}}
|
||||||
|
</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
|
||||||
|
<el-descriptions-item label="使用时间" :span="2">
|
||||||
|
{{ parseTime(form.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 药品明细 -->
|
||||||
|
<el-card shadow="never" class="detail-card" style="margin-top: 16px;">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<el-icon>
|
||||||
|
<List />
|
||||||
|
</el-icon> 药品使用明细
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-table :data="swMedicineUsageDetailsList" stripe size="small"
|
||||||
|
:row-class-name="rowSwMedicineUsageDetailsIndex" style="width: 100%">
|
||||||
|
<el-table-column label="药品" prop="mediName" show-overflow-tooltip />
|
||||||
|
<el-table-column label="用量" prop="dosage" width="80" />
|
||||||
|
<el-table-column label="单位" prop="unit" align="center" :formatter="formatUnit" />
|
||||||
|
<el-table-column label="使用方法" align="center" prop="usageId" :formatter="formatUsage" />
|
||||||
|
<el-table-column label="生产厂家" prop="manufacturer" show-overflow-tooltip />
|
||||||
|
<el-table-column label="生产批号" prop="batchNumber" width="120" />
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="cancel">关 闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Usage">
|
||||||
|
import { listUsageInfo, getUsageInfo, delUsageInfo } from '@/api/biosafety/usageInfo'
|
||||||
|
import { getCurrentInstance, reactive, ref, toRefs } from 'vue'
|
||||||
|
import { listUnit } from "@/api/biosafety/unit"
|
||||||
|
import { listUsage } from "@/api/biosafety/usage"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { pres_type } = proxy.useDict('pres_type')
|
||||||
|
|
||||||
|
const usageList = ref([])
|
||||||
|
const swMedicineUsageDetailsList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref('')
|
||||||
|
const daterangeCreateTime = ref([])
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
useType: null,
|
||||||
|
createTime: null
|
||||||
|
},
|
||||||
|
rules: {}
|
||||||
|
})
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
|
||||||
|
const units = ref([]) // 单位下拉选项
|
||||||
|
const usages = ref([]) // 使用方法下拉选项
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取单位下拉数据源(单位字典)
|
||||||
|
* 将返回数据转换成 { value, label } 结构,供 el-option 使用
|
||||||
|
*/
|
||||||
|
function getUnit() {
|
||||||
|
listUnit().then(response => {
|
||||||
|
units.value = response.rows.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取处方使用方法下拉数据源
|
||||||
|
* 将返回数据转换成 { value, label } 结构,供 el-option 使用
|
||||||
|
*/
|
||||||
|
function getUsageOptions() {
|
||||||
|
listUsage().then(response => {
|
||||||
|
usages.value = response.rows.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}))
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 格式化使用方法
|
||||||
|
* 根据 usageId 查找对应的使用方法名称
|
||||||
|
*/
|
||||||
|
function formatUsage(row) {
|
||||||
|
const usage = usages.value.find(item => String(item.value) === String(row.usageId))
|
||||||
|
return usage?.label ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化单位
|
||||||
|
* 根据 unit 查找对应的单位名称
|
||||||
|
*/
|
||||||
|
function formatUnit(row) {
|
||||||
|
const unit = units.value.find(item => String(item.value) === String(row.unit))
|
||||||
|
return unit?.label ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
queryParams.value.params = {}
|
||||||
|
if (daterangeCreateTime.value && daterangeCreateTime.value.length === 2) {
|
||||||
|
queryParams.value.params.beginCreateTime = daterangeCreateTime.value[0]
|
||||||
|
queryParams.value.params.endCreateTime = daterangeCreateTime.value[1]
|
||||||
|
}
|
||||||
|
listUsageInfo(queryParams.value).then(res => {
|
||||||
|
usageList.value = res.rows
|
||||||
|
total.value = res.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
useType: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
swMedicineUsageDetailsList.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetQuery() {
|
||||||
|
daterangeCreateTime.value = []
|
||||||
|
proxy.resetForm('queryRef')
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDetail(row) {
|
||||||
|
reset()
|
||||||
|
getUsageInfo(row.id).then(res => {
|
||||||
|
form.value = res.data
|
||||||
|
swMedicineUsageDetailsList.value = res.data.swMedicineUsageDetailsList || []
|
||||||
|
open.value = true
|
||||||
|
title.value = '药品使用记录详情'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _ids = row.id || ids.value
|
||||||
|
proxy.$modal.confirm(`是否确认删除药品使用记录编号为"${_ids}"的数据项?`).then(() => {
|
||||||
|
return delUsageInfo(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowSwMedicineUsageDetailsIndex({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('biosafety/usageInfo/export', { ...queryParams.value }, `usage_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getList()
|
||||||
|
getUnit() // 获取单位下拉数据源
|
||||||
|
getUsageOptions() // 获取使用方法下拉数据源
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.usage-detail-dialog .detail-card {
|
||||||
|
border-radius: 6px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.usage-detail-dialog .card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.usage-detail-dialog .card-header .el-icon {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
</style>
|
311
src/views/dryMatterCorrection/dryMatterCorrection/index.vue
Normal file
311
src/views/dryMatterCorrection/dryMatterCorrection/index.vue
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="年月" prop="datetime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="queryParams.datetime"
|
||||||
|
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="['dryMatterCorrection:dryMatterCorrection:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['dryMatterCorrection:dryMatterCorrection:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['dryMatterCorrection:dryMatterCorrection:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['dryMatterCorrection:dryMatterCorrection:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="dryMatterCorrectionList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="年月" align="center" prop="datetime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.datetime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="厂区" align="center" prop="factory" />
|
||||||
|
<el-table-column label="干物质含量" align="center" prop="content" />
|
||||||
|
<el-table-column label="干物质标准" align="center" prop="standard" />
|
||||||
|
<!-- 新增干物质系数列 -->
|
||||||
|
<el-table-column label="干物质系数" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ calculateCoefficient(scope.row.content, scope.row.standard) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['dryMatterCorrection:dryMatterCorrection:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['dryMatterCorrection:dryMatterCorrection: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="dryMatterCorrectionRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="年月" prop="datetime">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.datetime"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="请选择年月">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 新增厂区字段 -->
|
||||||
|
<el-form-item label="厂区" prop="factory">
|
||||||
|
<el-input v-model="form.factory" placeholder="请输入厂区" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="干物质含量" prop="content">
|
||||||
|
<el-input v-model="form.content" placeholder="请输入干物质含量" @input="calculateCoefficientInForm" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="干物质标准" prop="standard">
|
||||||
|
<el-input v-model="form.standard" placeholder="请输入干物质标准" @input="calculateCoefficientInForm" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 显示计算后的干物质系数 -->
|
||||||
|
<el-form-item label="干物质系数">
|
||||||
|
<el-input v-model="form.coefficient" placeholder="自动计算" readonly />
|
||||||
|
</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="DryMatterCorrection">
|
||||||
|
import { listDryMatterCorrection, getDryMatterCorrection, delDryMatterCorrection, addDryMatterCorrection, updateDryMatterCorrection } from "@/api/dryMatterCorrection/dryMatterCorrection"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const dryMatterCorrectionList = 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,
|
||||||
|
datetime: null,
|
||||||
|
factory: null,
|
||||||
|
content: null,
|
||||||
|
standard: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
datetime: [
|
||||||
|
{ required: true, message: "年月不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
factory: [
|
||||||
|
{ required: true, message: "厂区不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
content: [
|
||||||
|
{ required: true, message: "干物质含量不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
standard: [
|
||||||
|
{ required: true, message: "干物质标准不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询干物质校正列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listDryMatterCorrection(queryParams.value).then(response => {
|
||||||
|
dryMatterCorrectionList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
datetime: null,
|
||||||
|
factory: null,
|
||||||
|
content: null,
|
||||||
|
standard: null,
|
||||||
|
coefficient: null // 新增系数字段
|
||||||
|
}
|
||||||
|
proxy.resetForm("dryMatterCorrectionRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
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
|
||||||
|
getDryMatterCorrection(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
// 计算修改时的干物质系数
|
||||||
|
form.value.coefficient = calculateCoefficient(form.value.content, form.value.standard)
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改干物质校正"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表单中计算干物质系数 */
|
||||||
|
function calculateCoefficientInForm() {
|
||||||
|
if (form.value.content && form.value.standard) {
|
||||||
|
const content = parseFloat(form.value.content)
|
||||||
|
const standard = parseFloat(form.value.standard)
|
||||||
|
if (!isNaN(content) && !isNaN(standard) && standard !== 0) {
|
||||||
|
form.value.coefficient = (content / standard).toFixed(4)
|
||||||
|
} else {
|
||||||
|
form.value.coefficient = null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
form.value.coefficient = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 表格中计算干物质系数 */
|
||||||
|
function calculateCoefficient(content, standard) {
|
||||||
|
if (content && standard) {
|
||||||
|
const contentVal = parseFloat(content)
|
||||||
|
const standardVal = parseFloat(standard)
|
||||||
|
if (!isNaN(contentVal) && !isNaN(standardVal) && standardVal !== 0) {
|
||||||
|
return (contentVal / standardVal).toFixed(4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'N/A'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["dryMatterCorrectionRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
// 提交前确保系数已计算
|
||||||
|
if (!form.value.coefficient) {
|
||||||
|
calculateCoefficientInForm()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateDryMatterCorrection(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addDryMatterCorrection(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 delDryMatterCorrection(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('dryMatterCorrection/dryMatterCorrection/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `dryMatterCorrection_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
223
src/views/produce/manage_sheep/add_sheep/index.vue
Normal file
223
src/views/produce/manage_sheep/add_sheep/index.vue
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-button type="warning" @click="handleExportForm">导出当前表单</el-button>
|
||||||
|
<el-button type="info" plain icon="Upload" @click="handleImport"
|
||||||
|
v-hasPermi="['produce:add_sheep:import']">导入</el-button>
|
||||||
|
<el-form :model="form" ref="formRef" label-position="left" label-width="100px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input v-model="form.sheepId" placeholder="请输入羊只id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="羊舍" prop="sheepfold">
|
||||||
|
<el-input v-model="form.sheepfold" placeholder="请输入羊舍" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="父号" prop="father">
|
||||||
|
<el-input v-model="form.father" placeholder="请输入父号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="母号" prop="mother">
|
||||||
|
<el-input v-model="form.mother" placeholder="请输入母号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="出生体重" prop="bornWeight">
|
||||||
|
<el-input v-model="form.bornWeight" placeholder="请输入出生体重" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="出生日期" prop="birthday">
|
||||||
|
<el-date-picker v-model="form.birthday" type="date" placeholder="选择出生日期" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-select v-model="form.gender" placeholder="请选择性别">
|
||||||
|
<el-option label="公" value="1" />
|
||||||
|
<el-option label="母" value="0" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="胎次" prop="parity">
|
||||||
|
<el-input v-model="form.parity" placeholder="请输入胎次" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="品种" prop="varietyId">
|
||||||
|
<el-input v-model="form.varietyId" placeholder="请输入品种" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="入群日期" prop="joinDate">
|
||||||
|
<el-date-picker v-model="form.joinDate" type="date" placeholder="选择入群日期" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" type="textarea" rows="3" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||||
|
<el-button @click="resetForm">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog title="导入羊只信息" v-model="importOpen" width="400px" append-to-body>
|
||||||
|
<el-upload ref="uploadRef" :limit="1" accept=".xlsx,.xls" :action="importUrl" :headers="headers"
|
||||||
|
:auto-upload="false" :on-success="handleImportSuccess" :on-error="handleImportError" drag>
|
||||||
|
<i class="el-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
</el-upload>
|
||||||
|
<template #footer>
|
||||||
|
<el-button type="info" @click="downloadTemplate">下载模板</el-button>
|
||||||
|
<el-button type="primary" @click="submitUpload">确 定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { addSheep } from '@/api/produce/manage_sheep/add_sheep/add_sheep';
|
||||||
|
|
||||||
|
const form = ref({
|
||||||
|
sheepId: '',
|
||||||
|
sheepfold: '',
|
||||||
|
father: '',
|
||||||
|
mother: '',
|
||||||
|
bornWeight: '',
|
||||||
|
birthday: '',
|
||||||
|
gender: '',
|
||||||
|
parity: '',
|
||||||
|
varietyId: '',
|
||||||
|
joinDate: '',
|
||||||
|
comment: '',
|
||||||
|
technician: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRef = ref(null);
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
sheepId: [{ required: true, message: '请输入羊只id', trigger: 'blur' }],
|
||||||
|
sheepfold: [{ required: true, message: '请输入羊舍', trigger: 'blur' }],
|
||||||
|
father: [{ message: '请输入父号', trigger: 'blur' }],
|
||||||
|
mother: [{ message: '请输入母号', trigger: 'blur' }],
|
||||||
|
bornWeight: [{ required: true, message: '请输入出生体重', trigger: 'blur' }],
|
||||||
|
birthday: [{ required: true, message: '请选择出生日期', trigger: 'change' }],
|
||||||
|
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
|
||||||
|
parity: [{ message: '请输入胎次', trigger: 'blur' }],
|
||||||
|
varietyId: [{ required: true, message: '请输入品种', trigger: 'blur' }],
|
||||||
|
joinDate: [{ message: '请选择入群日期', trigger: 'change' }],
|
||||||
|
technician: [{ message: '请输入技术员', trigger: 'blur' }],
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//表单验证
|
||||||
|
const submitForm = () => {
|
||||||
|
formRef.value.validate((valid) => {
|
||||||
|
console.log('表单验证结果:', valid);
|
||||||
|
if (valid) {
|
||||||
|
addSheep(form.value)
|
||||||
|
.then(response => {
|
||||||
|
console.log('后端响应:', response);
|
||||||
|
if (response.code === 200) {
|
||||||
|
alert('新增成功');
|
||||||
|
resetForm();
|
||||||
|
} else {
|
||||||
|
alert(response.msg || '新增失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
alert('请填写所有必填字段');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const resetForm = () => {
|
||||||
|
form.value = {
|
||||||
|
sheepId: '',
|
||||||
|
sheepfold: '',
|
||||||
|
father: '',
|
||||||
|
mother: '',
|
||||||
|
bornWeight: '',
|
||||||
|
birthday: '',
|
||||||
|
gender: '',
|
||||||
|
parity: '',
|
||||||
|
varietyId: '',
|
||||||
|
joinDate: '',
|
||||||
|
comment: '',
|
||||||
|
technician: '',
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//导出
|
||||||
|
import { exportSheepForm } from '@/api/produce/manage_sheep/add_sheep/add_sheep';
|
||||||
|
|
||||||
|
function handleExportForm() {
|
||||||
|
// 把当前表单数据直接传后端
|
||||||
|
exportSheepForm(form.value).then(res => {
|
||||||
|
// 使用 Ruoyi 自带的下载方法
|
||||||
|
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||||
|
const fileName = `羊只信息_${new Date().getTime()}.xlsx`;
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = URL.createObjectURL(blob);
|
||||||
|
link.download = fileName;
|
||||||
|
link.click();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//导入
|
||||||
|
import { getToken } from '@/utils/auth';
|
||||||
|
|
||||||
|
const uploadRef = ref();
|
||||||
|
const importOpen = ref(false);
|
||||||
|
const importUrl = ref(import.meta.env.VITE_APP_BASE_API + '/produce/manage_sheep/add_sheep/importData');
|
||||||
|
const headers = ref({ Authorization: 'Bearer ' + getToken() });
|
||||||
|
|
||||||
|
function handleImport() { importOpen.value = true; }
|
||||||
|
function downloadTemplate() {
|
||||||
|
proxy.download('/produce/manage_sheep/add_sheep/importTemplate', {}, `羊只模板_${Date.now()}.xlsx`);
|
||||||
|
}
|
||||||
|
function submitUpload() { uploadRef.value?.submit(); }
|
||||||
|
function handleImportSuccess(res) {
|
||||||
|
proxy.$modal.msgSuccess(res.msg || '导入成功');
|
||||||
|
importOpen.value = false;
|
||||||
|
uploadRef.value?.clearFiles();
|
||||||
|
}
|
||||||
|
function handleImportError(err) {
|
||||||
|
proxy.$modal.msgError(JSON.parse(err.message)?.msg || '导入失败');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.app-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
359
src/views/produce/manage_sheep/trans_group/index.vue
Normal file
359
src/views/produce/manage_sheep/trans_group/index.vue
Normal file
@ -0,0 +1,359 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input v-model="queryParams.sheepId" placeholder="请输入羊只id" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转入羊舍" prop="foldTo">
|
||||||
|
<el-input v-model="queryParams.foldTo" placeholder="请输入转入羊舍" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转出羊舍" prop="foldFrom">
|
||||||
|
<el-input v-model="queryParams.foldFrom" placeholder="请输入转出羊舍" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" style="width: 150px;" placeholder="请选择状态" clearable>
|
||||||
|
<el-option v-for="dict in status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
|
<el-date-picker v-model="daterangeCreateTime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||||
|
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
|
</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="['trans_group:trans_group:add']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
|
v-hasPermi="['trans_group:trans_group:edit']">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['trans_group:trans_group:remove']">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['trans_group:trans_group:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="trans_groupList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
||||||
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
|
<el-table-column label="转入羊舍" align="center" prop="foldTo" />
|
||||||
|
<el-table-column label="转出羊舍" align="center" prop="foldFrom" />
|
||||||
|
<el-table-column label="转群原因" align="center" prop="reason" min-width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="trans_group_reason" :value="scope.row.reason" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="status" :value="scope.row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleApprove(scope.row)"
|
||||||
|
v-hasPermi="['trans_group:trans_group:approve']">
|
||||||
|
审批
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['trans_group:trans_group: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="trans_groupRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input v-model="form.sheepId" placeholder="请输入羊只id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转入羊舍" prop="foldTo">
|
||||||
|
<el-input v-model="form.foldTo" placeholder="请输入转入羊舍" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转出羊舍" prop="foldFrom">
|
||||||
|
<el-input v-model="form.foldFrom" placeholder="请输入转出羊舍" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转群原因" prop="reason">
|
||||||
|
<el-select v-model="form.reason" placeholder="请选择转群原因">
|
||||||
|
<el-option v-for="dict in trans_group_reason" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" 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>
|
||||||
|
|
||||||
|
<!-- 审批对话框 -->
|
||||||
|
<el-dialog :title="'审批转群记录'" v-model="approveDialog" width="500px" append-to-body>
|
||||||
|
<el-form ref="approveFormRef" :model="approveForm" label-width="120px">
|
||||||
|
<el-form-item label="羊只id">
|
||||||
|
<el-input v-model="approveForm.sheepId" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转入羊舍">
|
||||||
|
<el-input v-model="approveForm.foldTo" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转出羊舍">
|
||||||
|
<el-input v-model="approveForm.foldFrom" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转群原因">
|
||||||
|
<el-select v-model="approveForm.reason" disabled>
|
||||||
|
<el-option v-for="dict in trans_group_reason" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员">
|
||||||
|
<el-input v-model="approveForm.technician" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="approveForm.comment" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleApproveAgree">同意</el-button>
|
||||||
|
<el-button type="danger" @click="handleApproveReject">驳回</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Trans_group">
|
||||||
|
import { listTrans_group, getTrans_group, delTrans_group, addTrans_group, updateTrans_group } from "@/api/produce/manage_sheep/trans_group/trans_group"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { trans_group_reason, status } = proxy.useDict('trans_group_reason', 'status')
|
||||||
|
|
||||||
|
const trans_groupList = 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 daterangeCreateTime = ref([])
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
sheepId: null,
|
||||||
|
foldTo: null,
|
||||||
|
foldFrom: null,
|
||||||
|
status: null,
|
||||||
|
createTime: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "$comment不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepId: [
|
||||||
|
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
foldTo: [
|
||||||
|
{ required: true, message: "转入羊舍不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
foldFrom: [
|
||||||
|
{ required: true, message: "转出羊舍不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
reason: [
|
||||||
|
{ required: true, message: "转群原因不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
technician: [
|
||||||
|
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询转群记录列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
queryParams.value.params = {}
|
||||||
|
if (null != daterangeCreateTime && '' != daterangeCreateTime) {
|
||||||
|
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
||||||
|
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
||||||
|
}
|
||||||
|
listTrans_group(queryParams.value).then(response => {
|
||||||
|
trans_groupList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
sheepId: null,
|
||||||
|
foldTo: null,
|
||||||
|
foldFrom: null,
|
||||||
|
reason: null,
|
||||||
|
technician: null,
|
||||||
|
status: null,
|
||||||
|
comment: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("trans_groupRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
daterangeCreateTime.value = []
|
||||||
|
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
|
||||||
|
getTrans_group(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改转群记录"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["trans_groupRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateTrans_group(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addTrans_group(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 delTrans_group(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('/produce/manage_sheep/trans_group/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `trans_group_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
|
||||||
|
// 审批记录的对话框
|
||||||
|
const approveDialog = ref(false);
|
||||||
|
const approveForm = ref({});
|
||||||
|
|
||||||
|
// 审批按钮操作
|
||||||
|
function handleApprove(row) {
|
||||||
|
// 打开审批对话框
|
||||||
|
approveForm.value = { ...row };
|
||||||
|
approveDialog.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同意审批
|
||||||
|
function handleApproveAgree() {
|
||||||
|
approveForm.value.status = 1; // 状态设置为同意
|
||||||
|
updateTrans_group(approveForm.value).then(() => {
|
||||||
|
approveDialog.value = false;
|
||||||
|
proxy.$modal.msgSuccess("审批成功,状态已更新为同意");
|
||||||
|
getList();
|
||||||
|
}).catch((error) => {
|
||||||
|
proxy.$modal.msgError(`审批失败:${error}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 驳回审批
|
||||||
|
function handleApproveReject() {
|
||||||
|
approveForm.value.status = 2; // 状态设置为驳回
|
||||||
|
updateTrans_group(approveForm.value).then(() => {
|
||||||
|
approveDialog.value = false;
|
||||||
|
proxy.$modal.msgSuccess("审批成功,状态已更新为驳回");
|
||||||
|
getList();
|
||||||
|
}).catch((error) => {
|
||||||
|
proxy.$modal.msgError(`审批失败:${error}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
413
src/views/produce/manage_sheep/transition_info/index.vue
Normal file
413
src/views/produce/manage_sheep/transition_info/index.vue
Normal file
@ -0,0 +1,413 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.sheepId"
|
||||||
|
placeholder="请输入羊只id"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转入牧场" prop="transTo">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.transTo"
|
||||||
|
placeholder="请输入转入牧场"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前牧场" prop="transFrom">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.transFrom"
|
||||||
|
placeholder="请输入当前牧场"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" style="width: 150px;" placeholder="请选择状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in status"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterangeCreateTime"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</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="['transition_info:transition_info:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['transition_info:transition_info:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['transition_info:transition_info:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['transition_info:transition_info:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="transition_infoList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="" align="center" prop="id" /> -->
|
||||||
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
|
<el-table-column label="转入牧场" align="center" prop="transTo" />
|
||||||
|
<el-table-column label="当前牧场" align="center" prop="transFrom" />
|
||||||
|
<el-table-column label="转场类型" align="center" prop="transType">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="trans_type" :value="scope.row.transType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="status" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleApprove(scope.row)" v-hasPermi="['transition_info:transition_info:approve']">审批</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['transition_info:transition_info: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="transition_infoRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input v-model="form.sheepId" placeholder="请输入羊只id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转入牧场" prop="transTo">
|
||||||
|
<el-input v-model="form.transTo" placeholder="请输入转入牧场" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前牧场" prop="transFrom">
|
||||||
|
<el-input v-model="form.transFrom" placeholder="请输入当前牧场" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转场类型" prop="transType">
|
||||||
|
<el-select v-model="form.transType" placeholder="请选择转场类型">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in trans_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="parseInt(dict.value)"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" 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>
|
||||||
|
|
||||||
|
<!-- 审批对话框 -->
|
||||||
|
<el-dialog :title="'审批转场记录'" v-model="approveDialog" width="500px" append-to-body>
|
||||||
|
<el-form ref="approveFormRef" :model="approveForm" label-width="120px">
|
||||||
|
<el-form-item label="羊只id">
|
||||||
|
<el-input v-model="approveForm.sheepId" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转入牧场">
|
||||||
|
<el-input v-model="approveForm.transTo" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前牧场">
|
||||||
|
<el-input v-model="approveForm.transFrom" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转场类型">
|
||||||
|
<el-select v-model="approveForm.transType" disabled>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in trans_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员">
|
||||||
|
<el-input v-model="approveForm.technician" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="approveForm.comment" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleApproveAgree">同意</el-button>
|
||||||
|
<el-button type="danger" @click="handleApproveReject">驳回</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Transition_info">
|
||||||
|
import { listTransition_info, getTransition_info, delTransition_info, addTransition_info, updateTransition_info } from "@/api/produce/manage_sheep/transition_info/transition_info"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { status, trans_type } = proxy.useDict('status', 'trans_type')
|
||||||
|
|
||||||
|
const transition_infoList = 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 daterangeCreateTime = ref([])
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
sheepId: null,
|
||||||
|
transTo: null,
|
||||||
|
transFrom: null,
|
||||||
|
status: null,
|
||||||
|
createTime: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepId: [
|
||||||
|
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
transTo: [
|
||||||
|
{ required: true, message: "转入牧场不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
transFrom: [
|
||||||
|
{ required: true, message: "当前牧场不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
transType: [
|
||||||
|
{ required: true, message: "转场类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
technician: [
|
||||||
|
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询转场列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
queryParams.value.params = {}
|
||||||
|
if (null != daterangeCreateTime && '' != daterangeCreateTime) {
|
||||||
|
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
||||||
|
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
||||||
|
}
|
||||||
|
listTransition_info(queryParams.value).then(response => {
|
||||||
|
transition_infoList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
sheepId: null,
|
||||||
|
transTo: null,
|
||||||
|
transFrom: null,
|
||||||
|
transType: null,
|
||||||
|
technician: null,
|
||||||
|
status: null,
|
||||||
|
comment: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("transition_infoRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
daterangeCreateTime.value = []
|
||||||
|
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
|
||||||
|
getTransition_info(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改转场"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["transition_infoRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateTransition_info(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addTransition_info(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 delTransition_info(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('/produce/manage_sheep/transition_info/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `transition_info_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
// 审批记录的对话框
|
||||||
|
const approveDialog = ref(false);
|
||||||
|
const approveForm = ref({});
|
||||||
|
|
||||||
|
// 审批按钮操作
|
||||||
|
function handleApprove(row) {
|
||||||
|
// 打开审批对话框
|
||||||
|
approveForm.value = { ...row };
|
||||||
|
approveDialog.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同意审批
|
||||||
|
function handleApproveAgree() {
|
||||||
|
approveForm.value.status = 1; // 状态设置为同意
|
||||||
|
updateTransition_info(approveForm.value).then(() => {
|
||||||
|
approveDialog.value = false;
|
||||||
|
proxy.$modal.msgSuccess("审批成功,状态已更新为同意");
|
||||||
|
getList();
|
||||||
|
}).catch((error) => {
|
||||||
|
proxy.$modal.msgError(`审批失败:${error}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 驳回审批
|
||||||
|
function handleApproveReject() {
|
||||||
|
approveForm.value.status = 2; // 状态设置为驳回
|
||||||
|
updateTransition_info(approveForm.value).then(() => {
|
||||||
|
approveDialog.value = false;
|
||||||
|
proxy.$modal.msgSuccess("审批成功,状态已更新为驳回");
|
||||||
|
getList();
|
||||||
|
}).catch((error) => {
|
||||||
|
proxy.$modal.msgError(`审批失败:${error}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getList()
|
||||||
|
</script>
|
@ -2,30 +2,16 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="羊只id" prop="sheepId">
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
<el-input
|
<el-input v-model="queryParams.sheepId" placeholder="请输入羊只id" clearable @keyup.enter="handleQuery" />
|
||||||
v-model="queryParams.sheepId"
|
|
||||||
placeholder="请输入羊只id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="羊舍id" prop="sheepfold">
|
<el-form-item label="羊舍" prop="sheepfold">
|
||||||
<el-input
|
<el-select v-model="queryParams.sheepfold" placeholder="请选择羊舍" style="min-width:150px" clearable>
|
||||||
v-model="queryParams.sheepfold"
|
<el-option v-for="item in sheepfoldOptions" :key="item.id" :label="item.sheepfoldName" :value="item.id" />
|
||||||
placeholder="请输入羊舍id"
|
</el-select>
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" style="width: 308px">
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
<el-date-picker
|
<el-date-picker v-model="daterangeCreateTime" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||||
v-model="daterangeCreateTime"
|
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
type="daterange"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
></el-date-picker>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
@ -35,51 +21,29 @@
|
|||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
type="primary"
|
v-hasPermi="['produce:castrate:add']">新增</el-button>
|
||||||
plain
|
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['produce:castrate:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
type="success"
|
v-hasPermi="['produce:castrate:edit']">修改</el-button>
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['produce:castrate:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
type="danger"
|
v-hasPermi="['produce:castrate:remove']">删除</el-button>
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['produce:castrate:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
type="warning"
|
v-hasPermi="['produce:castrate:export']">导出</el-button>
|
||||||
plain
|
|
||||||
icon="Download"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['produce:castrate:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="castrateList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="castrateList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="${comment}" align="center" prop="id" />
|
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
||||||
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
<el-table-column label="羊舍id" align="center" prop="sheepfold" />
|
<el-table-column label="羊舍名称" align="center" prop="sheepfoldName" />
|
||||||
<el-table-column label="备注" align="center" prop="comment" />
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
<el-table-column label="技术员" align="center" prop="technician" />
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
@ -89,19 +53,16 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['produce:castrate:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['produce:castrate:remove']">删除</el-button>
|
v-hasPermi="['produce:castrate:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['produce:castrate:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
v-show="total>0"
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNum"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改去势对话框 -->
|
<!-- 添加或修改去势对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
@ -109,8 +70,13 @@
|
|||||||
<el-form-item label="羊只id" prop="sheepId">
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
<el-input v-model="form.sheepId" placeholder="请输入羊只id" />
|
<el-input v-model="form.sheepId" placeholder="请输入羊只id" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="羊舍id" prop="sheepfold">
|
<el-form-item label="羊舍" prop="sheepfold">
|
||||||
<el-input v-model="form.sheepfold" placeholder="请输入羊舍id" />
|
<el-select v-model="form.sheepfold" placeholder="请选择羊舍" clearable>
|
||||||
|
<el-option v-for="fold in sheepfoldOptions" :key="fold.id" :label="fold.sheepfoldName" :value="fold.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" placeholder="请输入技术员" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="comment">
|
<el-form-item label="备注" prop="comment">
|
||||||
<el-input v-model="form.comment" placeholder="请输入备注" />
|
<el-input v-model="form.comment" placeholder="请输入备注" />
|
||||||
@ -126,8 +92,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Castrate">
|
<script setup name="castrate">
|
||||||
import { listCastrate, getCastrate, delCastrate, addCastrate, updateCastrate } from "@/api/produce/castrate"
|
import { listCastrate, getCastrate, delCastrate, addCastrate, updateCastrate } from "@/api/produce/other/castrate/castrate"
|
||||||
|
import { listSheepfold_management as listSheepfold } from '@/api/sheepfold_management/sheepfold_management';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
@ -153,6 +120,18 @@ const data = reactive({
|
|||||||
createTime: null
|
createTime: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "$comment不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepId: [
|
||||||
|
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepfold: [
|
||||||
|
{ required: true, message: "羊舍不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
technician: [
|
||||||
|
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -255,20 +234,31 @@ function submitForm() {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const _ids = row.id || ids.value
|
const _ids = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除去势编号为"' + _ids + '"的数据项?').then(function() {
|
proxy.$modal.confirm('是否确认删除去势编号为"' + _ids + '"的数据项?').then(function () {
|
||||||
return delCastrate(_ids)
|
return delCastrate(_ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList()
|
getList()
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
}).catch(() => {})
|
}).catch(() => { })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('produce/castrate/export', {
|
proxy.download('/produce/other/castrate/export', {
|
||||||
...queryParams.value
|
...queryParams.value
|
||||||
}, `castrate_${new Date().getTime()}.xlsx`)
|
}, `castrate_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 加载所有羊舍 */
|
||||||
|
const sheepfoldOptions = ref([]);
|
||||||
|
function getSheepfoldOptions() {
|
||||||
|
listSheepfold({ pageNum: 1, pageSize: 9999 }).then(res => {
|
||||||
|
sheepfoldOptions.value = res.rows; // [{id, sheepfoldName}, ...]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
getSheepfoldOptions();
|
||||||
|
});
|
||||||
getList()
|
getList()
|
||||||
</script>
|
</script>
|
||||||
|
291
src/views/produce/other/fixHoof/index.vue
Normal file
291
src/views/produce/other/fixHoof/index.vue
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.sheepId"
|
||||||
|
placeholder="请输入羊只id"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 羊舍 -->
|
||||||
|
<el-form-item label="羊舍id" prop="sheepfold">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.sheepfold"
|
||||||
|
placeholder="请输入羊舍id"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterangeCreateTime"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</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="['fixHoof:fixHoof:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['fixHoof:fixHoof:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['fixHoof:fixHoof:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['fixHoof:fixHoof:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="fixHoofList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
|
||||||
|
<el-table-column label="羊只id" align="center" prop="sheepId" />
|
||||||
|
<el-table-column label="羊舍id" align="center" prop="sheepfold" />
|
||||||
|
<el-table-column label="备注" align="center" prop="comment" />
|
||||||
|
<el-table-column label="技术员" align="center" prop="technician" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fixHoof:fixHoof:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['fixHoof:fixHoof: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="fixHoofRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="羊只id" prop="sheepId">
|
||||||
|
<el-input v-model="form.sheepId" placeholder="请输入羊只id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="羊舍id" prop="sheepfold">
|
||||||
|
<el-input v-model="form.sheepfold" placeholder="请输入羊舍id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="comment">
|
||||||
|
<el-input v-model="form.comment" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="技术员" prop="technician">
|
||||||
|
<el-input v-model="form.technician" 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="FixHoof">
|
||||||
|
import { listFixHoof, getFixHoof, delFixHoof, addFixHoof, updateFixHoof } from "@/api/produce/other/fixHoof/fixHoof"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
|
const fixHoofList = 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 daterangeCreateTime = ref([])
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
sheepId: null,
|
||||||
|
sheepfold: null,
|
||||||
|
technician: null,
|
||||||
|
createTime: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
id: [
|
||||||
|
{ required: true, message: "$comment不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepId: [
|
||||||
|
{ required: true, message: "羊只id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sheepfold: [
|
||||||
|
{ required: true, message: "羊舍id不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
technician: [
|
||||||
|
{ required: true, message: "技术员不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询修蹄列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
queryParams.value.params = {}
|
||||||
|
if (null != daterangeCreateTime && '' != daterangeCreateTime) {
|
||||||
|
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0]
|
||||||
|
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1]
|
||||||
|
}
|
||||||
|
listFixHoof(queryParams.value).then(response => {
|
||||||
|
fixHoofList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: null,
|
||||||
|
sheepId: null,
|
||||||
|
sheepfold: null,
|
||||||
|
comment: null,
|
||||||
|
technician: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("fixHoofRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
daterangeCreateTime.value = []
|
||||||
|
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
|
||||||
|
getFixHoof(_id).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改修蹄"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["fixHoofRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != null) {
|
||||||
|
updateFixHoof(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addFixHoof(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 delFixHoof(_ids)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('/produce/other/fixHoof/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `fixHoof_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList()
|
||||||
|
</script>
|
Loading…
x
Reference in New Issue
Block a user