fix(xumu): 修复审计页面数据获取问题
- 在 AppDeathAudit 和 AppOutAudit 组件中,修改了 getDetail 方法 - 从 API 响应中获取正确的数据结构,确保详细信息正确显示 - 优化了代码格式,提高了可读性
This commit is contained in:
@@ -35,8 +35,8 @@ export default {
|
||||
getDetail() {
|
||||
const {id} = this.$route.query
|
||||
return id && this.instance.post("/api/breed/death/getAuditPage", {id}).then(res => {
|
||||
if (res?.data) {
|
||||
const detail = res.data || {}
|
||||
if (res?.data?.records?.[0]) {
|
||||
const detail = res.data.records[0] || {}
|
||||
if (detail.picture) {
|
||||
Object.entries(JSON.parse(detail.picture)).forEach(([key, value]) => {
|
||||
detail[key] = value
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import {mapState} from "vuex"
|
||||
import { mapState } from "vuex"
|
||||
|
||||
export default {
|
||||
name: "oaAdd",
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail: {detailList: []}
|
||||
detail: { detailList: [] }
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -22,17 +22,17 @@ export default {
|
||||
},
|
||||
isAudit: v => v.$route.hash == "#audit",
|
||||
formImages: v => [
|
||||
{label: "身长测量照片", prop: "heightPic"},
|
||||
{label: "生物芯片照片", prop: "biochipPic"},
|
||||
{label: "防疫耳标照片", prop: "preventionPic"},
|
||||
{label: "其他说明照片", prop: "otherPic"},
|
||||
{ label: "身长测量照片", prop: "heightPic" },
|
||||
{ label: "生物芯片照片", prop: "biochipPic" },
|
||||
{ label: "防疫耳标照片", prop: "preventionPic" },
|
||||
{ label: "其他说明照片", prop: "otherPic" },
|
||||
],
|
||||
columns: v => [
|
||||
{label: "序号", type: "index"},
|
||||
{label: "生物芯片耳标号", prop: "biochipEarNumber"},
|
||||
{label: "身长测量照片", prop: "heightPicture", upload: {instance: v.instance, readonly: !0, valueIsUrl: !0, limit: 1}},
|
||||
{label: "电子耳标照片", prop: "earNumberPicture", upload: {instance: v.instance, readonly: !0, valueIsUrl: !0, limit: 1}},
|
||||
{label: "防疫耳标照片", prop: "preventionPicture", upload: {instance: v.instance, readonly: !0, valueIsUrl: !0, limit: 1}},
|
||||
{ label: "序号", type: "index" },
|
||||
{ label: "生物芯片耳标号", prop: "biochipEarNumber" },
|
||||
{ label: "身长测量照片", prop: "heightPicture", upload: { instance: v.instance, readonly: !0, valueIsUrl: !0, limit: 1 } },
|
||||
{ label: "电子耳标照片", prop: "earNumberPicture", upload: { instance: v.instance, readonly: !0, valueIsUrl: !0, limit: 1 } },
|
||||
{ label: "防疫耳标照片", prop: "preventionPicture", upload: { instance: v.instance, readonly: !0, valueIsUrl: !0, limit: 1 } },
|
||||
].filter(e => !e.hide),
|
||||
},
|
||||
methods: {
|
||||
@@ -40,17 +40,17 @@ export default {
|
||||
this.$router.push(params)
|
||||
},
|
||||
getDetail() {
|
||||
const {id} = this.$route.query
|
||||
return id && this.instance.post("/api/breed/out/getAuditPage", {id}).then(res => {
|
||||
if (res?.data) {
|
||||
const detail = res.data
|
||||
return this.detail = {...detail}
|
||||
const { id } = this.$route.query
|
||||
return id && this.instance.post("/api/breed/out/getAuditPage", { id }).then(res => {
|
||||
if (res?.data?.records?.[0]) {
|
||||
const detail = res.data.records[0] || {}
|
||||
return this.detail = { ...detail }
|
||||
}
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.$refs.detail.validate().then(() => {
|
||||
this.instance.post("/api/breed/out/audit", {...this.detail}).then(res => {
|
||||
this.instance.post("/api/breed/out/audit", { ...this.detail }).then(res => {
|
||||
if (res?.code == '0') {
|
||||
this.$message.success("提交成功!")
|
||||
this.back()
|
||||
@@ -71,55 +71,55 @@ export default {
|
||||
<ai-card title="基础信息">
|
||||
<div class="grid c-4">
|
||||
<el-form-item label="生物芯片耳标号" class="row">
|
||||
<b v-text="detail.biochipEarNumber"/>
|
||||
<b v-text="detail.biochipEarNumber" />
|
||||
</el-form-item>
|
||||
<el-form-item label="养殖场" prop="farmId">
|
||||
<b v-text="detail.farmName"/>
|
||||
<b v-text="detail.farmName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="养殖舍" prop="houseId">
|
||||
<b v-text="detail.houseName"/>
|
||||
<b v-text="detail.houseName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="养殖栏" prop="penId">
|
||||
<b v-text="detail.penName"/>
|
||||
<b v-text="detail.penName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电子耳标号" prop="electronicEarNumber">
|
||||
<b v-text="detail.electronicEarNumber"/>
|
||||
<b v-text="detail.electronicEarNumber" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原厂耳标号" prop="category">
|
||||
<b v-text="detail.originalEarNumber"/>
|
||||
<b v-text="detail.originalEarNumber" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类别" prop="category">
|
||||
<b v-text="detail.category"/>
|
||||
<b v-text="detail.category" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品种" prop="variety">
|
||||
<b v-text="detail.variety"/>
|
||||
<b v-text="detail.variety" />
|
||||
</el-form-item>
|
||||
<div class="row flex">
|
||||
<el-form-item v-for="(img,i) in formImages" :key="i" v-bind="img">
|
||||
<ai-uploader v-model="detail[img.prop]" value-is-url readonly/>
|
||||
<el-form-item v-for="(img, i) in formImages" :key="i" v-bind="img">
|
||||
<ai-uploader v-model="detail[img.prop]" value-is-url readonly />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</ai-card>
|
||||
<ai-card title="淘汰信息">
|
||||
<el-form-item label="淘汰原因">
|
||||
<b v-text="dict.getLabel('outReason',detail.reason)"/>
|
||||
<b v-text="dict.getLabel('outReason', detail.reason)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="淘汰时间">
|
||||
<b v-text="detail.outTime"/>
|
||||
<b v-text="detail.outTime" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<b v-text="detail.remark"/>
|
||||
<b v-text="detail.remark" />
|
||||
</el-form-item>
|
||||
</ai-card>
|
||||
<ai-card title="审核信息">
|
||||
<div class="grid">
|
||||
<template v-if="isAudit">
|
||||
<el-form-item label="审批状态" prop="auditStatus" :rules="{required:true,message:'请选择审批状态'}">
|
||||
<ai-select v-model="detail.auditStatus" dict="auditStatus"/>
|
||||
<el-form-item label="审批状态" prop="auditStatus" :rules="{ required: true, message: '请选择审批状态' }">
|
||||
<ai-select v-model="detail.auditStatus" dict="auditStatus" />
|
||||
</el-form-item>
|
||||
<el-form-item label="意见">
|
||||
<ai-input type="textarea" :rows="3" v-model="detail.remark"/>
|
||||
<ai-input type="textarea" :rows="3" v-model="detail.remark" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
||||
Reference in New Issue
Block a user