fix(xumu): 修复理赔申请页面的耳标选择和数据加载问题
- 优化耳标选择功能,将选中的耳标数据格式化后赋值给 detail.detailList - 初始化 detail 对象时添加 list 属性,确保数据结构一致性 - 优化数据加载逻辑,处理可能的空值情况 - 调整页面布局和样式,提高可读性
This commit is contained in:
		| @@ -1,17 +1,17 @@ | ||||
| <script> | ||||
| import {mapState} from "vuex" | ||||
| import { mapState } from "vuex" | ||||
| import AiEartagPicker from "@project/xumu/components/AiEartagPicker.vue"; | ||||
|  | ||||
| const records = [ | ||||
|   {label: "序号", type: "index"}, | ||||
|   {label: "报案号", prop: "reportNo"}, | ||||
|   {label: "审批状态", prop: "auditStatus", dict: "auditStatus"}, | ||||
|   {label: "审批时间", prop: "auditTime"}, | ||||
|   {label: "审批人", prop: "auditName"}, | ||||
|   { label: "序号", type: "index" }, | ||||
|   { label: "报案号", prop: "reportNo" }, | ||||
|   { label: "审批状态", prop: "auditStatus", dict: "auditStatus" }, | ||||
|   { label: "审批时间", prop: "auditTime" }, | ||||
|   { label: "审批人", prop: "auditName" }, | ||||
| ] | ||||
| export default { | ||||
|   name: "claimAdd", | ||||
|   components: {AiEartagPicker}, | ||||
|   components: { AiEartagPicker }, | ||||
|   props: { | ||||
|     instance: Function, | ||||
|     permissions: Function, | ||||
| @@ -19,7 +19,7 @@ export default { | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       detail: {detailList: []}, | ||||
|       detail: { detailList: [], list: [] }, | ||||
|       records | ||||
|     } | ||||
|   }, | ||||
| @@ -32,17 +32,17 @@ export default { | ||||
|     }, | ||||
|     isClaim: v => v.$route.hash == "#claim", | ||||
|     formImages: v => [ | ||||
|       {label: "勘察报告书", prop: "surveyPicture", rules: {required: v.isClaim, message: '请上传 勘察报告书'}}, | ||||
|       {label: "无害化回执单", prop: "receiptPicture", rules: {required: v.isClaim, message: '请上传 无害化回执单'}}, | ||||
|       { label: "勘察报告书", prop: "surveyPicture", rules: { required: v.isClaim, message: '请上传 勘察报告书' } }, | ||||
|       { label: "无害化回执单", prop: "receiptPicture", rules: { required: v.isClaim, message: '请上传 无害化回执单' } }, | ||||
|     ], | ||||
|     columns: v => [ | ||||
|       {label: "序号", type: "index"}, | ||||
|       {label: "生物芯片耳标号", prop: "biochipEarNumber"}, | ||||
|       {label: "身长测量照片", prop: "heightPicture", upload: {instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1}}, | ||||
|       {label: "电子耳标照片", prop: "earNumberPicture", upload: {instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1}}, | ||||
|       {label: "防疫耳标照片", prop: "preventionPicture", upload: {instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1}}, | ||||
|       {label: "无害化处理照片", prop: "harmlessPicture", upload: {instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1}}, | ||||
|       {label: "报案号", prop: "reportNo", hide: v.isClaim}, | ||||
|       { label: "序号", type: "index" }, | ||||
|       { label: "生物芯片耳标号", prop: "biochipEarNumber" }, | ||||
|       { label: "身长测量照片", prop: "heightPicture", upload: { instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1 } }, | ||||
|       { label: "电子耳标照片", prop: "earNumberPicture", upload: { instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1 } }, | ||||
|       { label: "防疫耳标照片", prop: "preventionPicture", upload: { instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1 } }, | ||||
|       { label: "无害化处理照片", prop: "harmlessPicture", upload: { instance: v.instance, readonly: !v.isClaim, valueIsUrl: !0, limit: 1 } }, | ||||
|       { label: "报案号", prop: "reportNo", hide: v.isClaim }, | ||||
|     ].filter(e => !e.hide), | ||||
|     selectedEartags: v => v.detail.list?.length || 0, | ||||
|   }, | ||||
| @@ -51,17 +51,18 @@ export default { | ||||
|       this.$router.push(params) | ||||
|     }, | ||||
|     getDetail() { | ||||
|       const {id} = this.$route.query | ||||
|       return id && this.instance.post("/api/insurance/claim/apply/getInfo", null, {params: {orderNo: id}}).then(res => { | ||||
|       const { id } = this.$route.query | ||||
|       return id && this.instance.post("/api/insurance/claim/apply/getInfo", null, { params: { orderNo: id } }).then(res => { | ||||
|         if (res?.data) { | ||||
|           const detail = res.data | ||||
|           return this.detail = {...detail} | ||||
|           detail.detailList = detail.detailList || [] | ||||
|           return this.detail = { ...detail } | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     submit() { | ||||
|       this.$refs.detail.validate().then(() => { | ||||
|         this.instance.post("/api/insurance/claim/apply/add", {...this.detail}).then(res => { | ||||
|         this.instance.post("/api/insurance/claim/apply/add", { ...this.detail }).then(res => { | ||||
|           if (res?.code == '0') { | ||||
|             this.$message.success("提交成功!") | ||||
|             this.back() | ||||
| @@ -82,43 +83,44 @@ export default { | ||||
|       <ai-card title="基础信息"> | ||||
|         <div class="grid"> | ||||
|           <el-form-item label="养殖场" prop="farmId"> | ||||
|             <b v-text="detail.farmName"/> | ||||
|             <b v-text="detail.farmName" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="承保公司" prop="companyId"> | ||||
|             <b v-text="detail.companyName"/> | ||||
|             <b v-text="detail.companyName" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="投保类型"> | ||||
|             <ai-input :value="dict.getLabel('insureType',detail.insureType)" :edit="!1"/> | ||||
|             <ai-input :value="dict.getLabel('insureType', detail.insureType)" :edit="!1" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="保险产品" prop="productType"> | ||||
|             <b v-text="detail.productType"/> | ||||
|             <b v-text="detail.productType" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="联系人"> | ||||
|             <ai-input v-model="detail.contacts" :edit="!1"/> | ||||
|             <ai-input v-model="detail.contacts" :edit="!1" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="联系电话"> | ||||
|             <ai-input v-model="detail.phone" :edit="!1"/> | ||||
|             <ai-input v-model="detail.phone" :edit="!1" /> | ||||
|           </el-form-item> | ||||
|         </div> | ||||
|       </ai-card> | ||||
|       <ai-card title="投保对象"> | ||||
|         <template #right v-if="isClaim"> | ||||
|           <ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance" | ||||
|                             :action="`/api/insurance/claim/apply/getClaimEarNumberList?orderNo=${detail.orderNo}`"> | ||||
|           <ai-eartag-picker @select="v => detail.detailList = v.map(e=>({biochipEarNumber:e}))" :instance="instance" | ||||
|             :action="`/api/insurance/claim/apply/getClaimEarNumberList?orderNo=${detail.orderNo}`"> | ||||
|             <el-button type="text">选择</el-button> | ||||
|           </ai-eartag-picker> | ||||
|         </template> | ||||
|         <ai-highlight class="mar-b8 font-14" :content="`投保标的共${detail.insureNumber||0}只,已理赔标的共 @v 只`" color="red" :value="selectedEartags"/> | ||||
|         <ai-table :tableData="detail.detailList" :colConfigs="columns" :isShowPagination="!1" hideOptions/> | ||||
|         <ai-highlight class="mar-b8 font-14" :content="`投保标的共${detail.insureNumber || 0}只,已理赔标的共 @v 只`" color="red" | ||||
|           :value="selectedEartags" /> | ||||
|         <ai-table :tableData="detail.detailList" :colConfigs="columns" :isShowPagination="!1" hideOptions /> | ||||
|       </ai-card> | ||||
|       <ai-card title="理赔材料" v-if="isClaim"> | ||||
|         <div class="font-12 mar-b8">只能上传JPG/PNG文件,且不超过2M,一次最多5张</div> | ||||
|         <el-form-item v-for="(img,i) in formImages" :key="i" v-bind="img"> | ||||
|           <ai-uploader v-model="detail[img.prop]" :instance="instance" value-is-url :limit="5"/> | ||||
|         <el-form-item v-for="(img, i) in formImages" :key="i" v-bind="img"> | ||||
|           <ai-uploader v-model="detail[img.prop]" :instance="instance" value-is-url :limit="5" /> | ||||
|         </el-form-item> | ||||
|       </ai-card> | ||||
|       <ai-card title="理赔记录" v-else> | ||||
|         <ai-table :tableData="detail.list" :colConfigs="records" :isShowPagination="!1" hideOptions/> | ||||
|         <ai-table :tableData="detail.list" :colConfigs="records" :isShowPagination="!1" hideOptions /> | ||||
|       </ai-card> | ||||
|     </el-form> | ||||
|     <div slot="footer"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user