feat(xumu): 新增电子档案功能

- 添加 AppBreedArchive 组件作为电子档案的主入口
- 实现档案列表页面,包括筛选、搜索和导出功能
- 实现档案详细信息页面,展示基础信息和记录
- 集成 vuex 状态管理,支持用户信息和字典数据的全局共享
This commit is contained in:
aixianling
2025-01-07 18:02:42 +08:00
parent 25010984f9
commit ced505b585
3 changed files with 247 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<script>
import add from "./add.vue";
import list from "./list.vue";
export default {
name: "AppBreedArchive",
label: "电子档案",
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
currentPage() {
let {hash} = this.$route
return hash == "#add" ? add : list
}
},
created() {
this.dict.load("archiveStatus", "category", "variety")
}
}
</script>
<template>
<section class="AppBreedArchive">
<component :is="currentPage" v-bind="$props"/>
</section>
</template>
<style scoped lang="scss">
.AppBreedArchive {
height: 100%;
}
</style>

View File

@@ -0,0 +1,102 @@
<script>
import {mapState} from "vuex"
const columns = {
weightList: [
{label: "序号", type: "index"},
{label: "重量", prop: "weight"},
{label: "称重时间", prop: "createTime"},
{label: "数据来源", prop: "source", dict: "dataSources"},
{label: "是否变更过", prop: "isUpdate", dict: "yesOrNo"},
]
}
const navs = [
{label: "体重记录", value: "weightList"}
]
export default {
name: "baAdd",
props: {
instance: Function,
permissions: Function,
dict: Object
},
data() {
return {
detail: {detailList: []},
active: "weightList",
columns, navs
}
},
computed: {
...mapState(["user"]),
userinfo: v => v.user.info || {},
isAdd: v => !v.$route.query.id,
isEdit: v => v.$route.query.edit == 1,
pageTitle: v => {
const appName = v.$parent.menuName || v.$parent.$options.label
return v.$route.query.id ? v.isEdit ? `编辑${appName}` : `${appName}详情` : `新增${appName}`
},
},
methods: {
back(params = {}) {
this.$router.push(params)
},
getDetail() {
const {id} = this.$route.query
return id && this.instance.post("/api/report/getInfo", null, {params: {biochipEarNumber: id}}).then(res => {
if (res?.data) {
const detail = res.data
return this.detail = {detailList: [], ...detail}
}
})
},
},
created() {
this.dict.load("auditStatus", "category", "variety")
this.getDetail()
}
}
</script>
<template>
<ai-page :title="pageTitle" class="baAdd" showBack content-string="blank">
<el-form size="small" label-width="120px" :model="detail" ref="detail">
<ai-card title="基础信息">
<div class="grid c-3">
<el-form-item label="养殖户" prop="userName" class="row">
<b v-text="detail.userName"/>
</el-form-item>
<el-form-item label="养殖场" prop="farmId">
<b v-text="detail.farmName"/>
</el-form-item>
<el-form-item label="养殖舍" prop="houseId">
<b v-text="detail.houseName"/>
</el-form-item>
<el-form-item label="养殖栏" prop="penId">
<b v-text="detail.penName"/>
</el-form-item>
<el-form-item label="生物芯片耳标号" prop="penId">
<b v-text="detail.biochipEarNumber"/>
</el-form-item>
<el-form-item label="电子耳标号" prop="penId">
<b v-text="detail.electronicEarNumber"/>
</el-form-item>
<el-form-item label="原厂耳标号" prop="penId">
<b v-text="detail.originalEarNumber"/>
</el-form-item>
</div>
</ai-card>
<ai-card title="记录">
<ai-table :colConfigs="columns[active]" :table-data="detail[active]" :isShowPagination="!1"/>
</ai-card>
</el-form>
<div slot="footer">
<el-button @click="back">返回</el-button>
</div>
</ai-page>
</template>
<style scoped lang="scss">
.baAdd {
}
</style>

View File

@@ -0,0 +1,110 @@
<script>
import {mapState} from "vuex"
const columns = [
{label: "序号", type: "index"},
{label: "养殖户", prop: "userName"},
{label: "养殖场", format: (v, row) => `${[row.farmName, row.houseName, row.penName].join("-")}`},
{label: "生物芯片耳标号", prop: "biochipEarNumber"},
{label: "电子耳标号", prop: "biochipEarNumber"},
{label: "原厂耳标号", prop: "biochipEarNumber"},
{label: "入栏日期", prop: "createTime", width: 160},
{label: "饲养时长(天)", prop: "days", width: 120},
{label: "最新体重(公斤)", prop: "weight", width: 120},
{label: "当前体温", prop: "temperatureStatus", dict: 'temperatureStatus'},
{label: "运动情况", prop: "sportsSituation", dict: "sportsSituation"},
]
export default {
name: "baList",
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
columns,
tableData: [],
page: {pageNum: 1, pageSize: 10, total: 0},
search: {},
dialog: false,
form: {}
}
},
computed: {
...mapState(['user']),
userinfo: v => v.user.info || {},
pageTitle: v => v.$parent.menuName || v.$parent.$options.label
},
watch: {
search: {
deep: true,
handler() {
this.page.pageNum = 1
this.getTableData()
}
}
},
methods: {
getTableData() {
this.instance.post("/api/report/getArchivePage", {...this.page, ...this.search}).then(res => {
if (res?.data) {
this.tableData = res.data?.records
this.page.total = res.data.total
}
})
},
},
created() {
this.getTableData()
}
}
</script>
<template>
<ai-page class="baList" :title="pageTitle">
<ai-search-bar>
<template #left>
<ai-select placeholder="全部养殖户" v-model="search.userId" :instance="instance" :action="`/api/report/getOrgList`" :prop="{label:'name'}" readonly/>
<ai-select placeholder="全部养殖场" v-model="search.farmId" :instance="instance" :action="`/api/siteUser/querySiteByUserId?userId=${search.userId||''}`" :prop="{label:'name'}"/>
<ai-select placeholder="全部养殖舍" v-model="search.houseId" :instance="instance" :action="`/api/siteUser/querySiteById?id=${search.farmId||-1}`" :prop="{label:'name'}"/>
<ai-select placeholder="全部养殖栏" v-model="search.penId" :instance="instance" :action="`/api/siteUser/querySiteById?id=${search.houseId||-1}`" :prop="{label:'name'}"/>
<ai-input placeholder="生物芯片耳标号" v-model="search.biochipEarNumber"/>
<ai-input placeholder="电子耳标号" v-model="search.electronicEarNumber"/>
<ai-input placeholder="原厂耳标号" v-model="search.originalEarNumber"/>
<ai-select placeholder="全部状态" v-model="search.status" dict="archiveStatus"/>
<ai-select placeholder="全部类别" v-model="search.category" dict="category"/>
<ai-select placeholder="全部品种" v-model="search.variety" dict="variety"/>
<ai-search label="入栏日期">
<el-date-picker v-model="search.beginDate" type="datetime" placeholder="开始日期" size="small"/>
<el-date-picker v-model="search.endDate" type="datetime" placeholder="结束日期" size="small"/>
</ai-search>
</template>
</ai-search-bar>
<ai-search-bar>
<template #left>
<ai-download :instance="instance" url="/api/report/exportArchive" :params="{...search,...page}" :fileName="`${pageTitle}导出表-${Date.now()}`"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :colConfigs="columns" :dict="dict" @getList="getTableData"
:total="page.total" :current.sync="page.pageNum" :size.sync="page.pageSize">
<el-table-column slot="options" label="操作" fixed="right" align="center">
<template slot-scope="{row}">
<div class="table-options">
<el-button type="text" @click="$router.push({hash:'#add',query:{id:row.biochipEarNumber}})">查看</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</ai-page>
</template>
<style scoped lang="scss">
.baList {
height: 100%;
.deleteBtn {
color: $errorColor;
}
}
</style>