- 在多个组件中,为 el-date-picker 组件添加 value-format="yyyy-MM-dd HH:mm:ss" 属性 - 这样做可以确保日期时间的格式一致性,避免潜在的时间格式问题
106 lines
3.8 KiB
Vue
106 lines
3.8 KiB
Vue
<script>
|
|
import {mapState} from "vuex"
|
|
|
|
const columns = [
|
|
{label: "序号", type: "index"},
|
|
{label: "养殖场", prop: "userName", format: (v, row) => `${[row.farmName, row.houseName, row.penName].join("-")}`},
|
|
{label: "生物芯片耳标号", prop: "biochipEarNumber"},
|
|
{label: "类别", prop: "category", dict: "category"},
|
|
{label: "品种", prop: "variety", dict: "variety"},
|
|
{label: "称重日期", prop: "todayCreateTime", width: 160},
|
|
{label: "当日体重(公斤)", prop: "todayWeight", width: 120},
|
|
{label: "上次称重日期", prop: "lastCreateTime", width: 160},
|
|
{label: "上次体重(公斤)", prop: "lastWeight", width: 120},
|
|
]
|
|
export default {
|
|
name: "weightList",
|
|
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/breed/weight/page", {...this.page, ...this.search}).then(res => {
|
|
if (res?.data) {
|
|
this.tableData = res.data?.records
|
|
this.page.total = res.data.total
|
|
}
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
this.dict.load("auditStatus", "category", "variety")
|
|
this.getTableData()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<ai-page class="weightList" :title="pageTitle">
|
|
<ai-search-bar>
|
|
<template #left>
|
|
<ai-select placeholder="全部养殖场" v-model="search.farmId" :instance="instance" :action="`/api/siteUser/querySiteByUserId?userId=${userinfo.id}`" :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-select placeholder="全部类别" v-model="search.category" dict="category"/>
|
|
<ai-select placeholder="全部品种" v-model="search.variety" dict="variety"/>
|
|
<el-input placeholder="生物芯片耳标号" v-model="search.biochipEarNumber" dict="authStatus" size="small" clearable/>
|
|
<ai-search label="称重日期">
|
|
<el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="search.weightBeginDate" type="datetime" placeholder="开始日期" size="small"/>
|
|
<el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="search.weightEndDate" type="datetime" placeholder="结束日期" size="small"/>
|
|
</ai-search>
|
|
</template>
|
|
</ai-search-bar>
|
|
<ai-search-bar>
|
|
<template #left>
|
|
<ai-download :instance="instance" url="/api/breed/weight/export" :params="{...search,...page}" :fileName="`称重导出表-${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">
|
|
.weightList {
|
|
height: 100%;
|
|
|
|
.deleteBtn {
|
|
color: $errorColor;
|
|
}
|
|
}
|
|
</style>
|