- 删除了 AiCard 组件的导入语句- 从 components 中移除了 AiCard 的注册 这个改动减少了组件的依赖,如果页面中没有使用 AiCard,这个改动是有益的。如果有使用 AiCard,需要检查并恢复相关功能。
		
			
				
	
	
		
			160 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			160 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <script>
 | |
| import {mapState} from "vuex"
 | |
| import AiEartagPicker from "@project/xumu/components/AiEartagPicker.vue";
 | |
| 
 | |
| const columns = [
 | |
|   {label: "序号", type: "index"},
 | |
|   {label: "生物芯片耳标号", prop: "biochipEarNumber"},
 | |
|   {label: "类别", prop: "category", dict: "category"},
 | |
|   {label: "品种", prop: "variety", dict: "variety"},
 | |
| ]
 | |
| const formImages = [
 | |
|   {label: "身份证(正面)", prop: "frontCard", rules: {required: true, message: '请上传 身份证(正面)'}},
 | |
|   {label: "身份证(反面)", prop: "reverseCard", rules: {required: true, message: '请上传 身份证(反面)'}},
 | |
|   {label: "营业执照", prop: "businessPic", rules: {required: true, message: '请上传 营业执照'}},
 | |
|   {label: "畜禽经营许可证", prop: "breedPic", rules: {required: true, message: '请上传 畜禽经营许可证'}},
 | |
|   {label: "动物防疫条件许可证", prop: "prevention", rules: {required: true, message: '请上传 动物防疫条件许可证'}},
 | |
| ]
 | |
| export default {
 | |
|   name: "iaAdd",
 | |
|   components: {AiEartagPicker},
 | |
|   props: {
 | |
|     instance: Function,
 | |
|     permissions: Function,
 | |
|     dict: Object
 | |
|   },
 | |
|   data() {
 | |
|     return {
 | |
|       detail: {detailList: []},
 | |
|       columns, formImages,
 | |
|       companyList: []
 | |
|     }
 | |
|   },
 | |
|   computed: {
 | |
|     ...mapState(["user"]),
 | |
|     userinfo: v => v.user.info || {},
 | |
|     pageTitle: v => {
 | |
|       const appName = v.$parent.menuName || v.$parent.$options.label
 | |
|       return v.$route.query.id ? v.isEdit ? `编辑${appName}` : `${appName}详情` : `新增${appName}`
 | |
|     },
 | |
|     isAdd: v => !v.$route.query.id,
 | |
|     isEdit: v => v.$route.query.edit == 1,
 | |
|   },
 | |
|   methods: {
 | |
|     back(params = {}) {
 | |
|       this.$router.push(params)
 | |
|     },
 | |
|     getDetail() {
 | |
|       const {id} = this.$route.query
 | |
|       return id && this.instance.post("/api/insurance/apply/getInfo", null, {params: {id}}).then(res => {
 | |
|         if (res?.data) {
 | |
|           const detail = res.data
 | |
|           detail.detailList = detail.weightList || []
 | |
|           let {farmPicture: picture = "{}"} = detail
 | |
|           picture = JSON.parse(picture)
 | |
|           return this.detail = {...detail, ...picture}
 | |
|         }
 | |
|       })
 | |
|     },
 | |
|     getCompanies() {
 | |
|       this.instance.post("/api/insurance/apply/getCompany").then(res => {
 | |
|         if (res?.data) {
 | |
|           this.companyList = res.data
 | |
|         }
 | |
|       })
 | |
|     },
 | |
|     getProducts(id) {
 | |
|       const item = this.companyList.find(e => e.id == id)
 | |
|       return item?.children || []
 | |
|     },
 | |
|     submit() {
 | |
|       this.$refs.detail.validate().then(() => {
 | |
|         this.form.biochipEarNumber = this.detail.biochipEarNumber
 | |
|         this.instance.post("/api/insurance/apply/addOrEdit", this.form).then(res => {
 | |
|           if (res?.code == 0) {
 | |
|             this.dialog = false
 | |
|             this.getDetail()
 | |
|           }
 | |
|         })
 | |
|       })
 | |
|     }
 | |
|   },
 | |
|   created() {
 | |
|     this.getCompanies()
 | |
|     this.getDetail()
 | |
|   }
 | |
| }
 | |
| </script>
 | |
| 
 | |
| <template>
 | |
|   <ai-page :title="pageTitle" class="iaAdd" showBack content-string="blank">
 | |
|     <el-form size="small" label-width="120px" :model="detail" ref="detail">
 | |
|       <ai-card title="基础信息">
 | |
|         <div class="grid">
 | |
|           <el-form-item label="养殖场" prop="farmId" :rules="{required:true,message:'请选择 养殖场'}">
 | |
|             <ai-select v-if="isAdd||isEdit" v-model="detail.farmId" :instance="instance" :action="`/api/siteUser/querySiteByUserId?userId=${userinfo.id}`" :prop="{label:'name'}"/>
 | |
|             <b v-else v-text="detail.farmName"/>
 | |
|           </el-form-item>
 | |
|           <el-form-item label="承保公司" prop="companyId" :rules="{required:true,message:'请选择 承保公司'}">
 | |
|             <ai-select v-if="isAdd||isEdit" v-model="detail.companyId" :select-list="companyList" :prop="{label:'name'}"/>
 | |
|             <b v-else v-text="detail.companyName"/>
 | |
|           </el-form-item>
 | |
|           <el-form-item label="保险产品" prop="productType" :rules="{required:true,message:'请选择 保险产品'}">
 | |
|             <ai-select v-if="isAdd||isEdit" v-model="detail.productType" :select-list="getProducts(detail.companyId)" :prop="{label:'name',value:'productType'}"
 | |
|                        @select="v=>$set(detail,'insureType',v.children[0].insureType)"/>
 | |
|             <b v-else v-text="detail.productType"/>
 | |
|           </el-form-item>
 | |
|           <el-form-item label="投保类型">
 | |
|             <ai-input :value="dict.getLabel('insureType',detail.insureType)" placeholder="根据保险产品自动带出" :edit="isAdd||isEdit" readonly/>
 | |
|           </el-form-item>
 | |
|           <el-form-item label="联系人">
 | |
|             <ai-input v-model="detail.contacts" :edit="isAdd||isEdit"/>
 | |
|           </el-form-item>
 | |
|           <el-form-item label="联系电话">
 | |
|             <ai-input v-model="detail.phone" :edit="isAdd||isEdit"/>
 | |
|           </el-form-item>
 | |
|         </div>
 | |
|       </ai-card>
 | |
|       <ai-card title="投保对象">
 | |
|         <template #right>
 | |
|           <ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance"
 | |
|                             :action="`/insurance/apply/getEarNumberList?farmId=${detail.farmId}`">
 | |
|             <el-button type="text">选择</el-button>
 | |
|           </ai-eartag-picker>
 | |
|         </template>
 | |
|         <ai-table :tableData="detail.detailList" :colConfigs="columns" :isShowPagination="!1" hideOptions/>
 | |
|       </ai-card>
 | |
|       <ai-card title="证件信息">
 | |
|         <el-form label-position="top" class="grid c-5">
 | |
|           <el-form-item v-for="(img,i) in formImages" :key="i" v-bind="img">
 | |
|             <ai-uploader v-if="isAdd||isEdit" v-model="detail[img.prop]" :instance="instance" :limit="1" value-is-url/>
 | |
|             <el-image :src="detail[img.prop]" :preview-src-list="[detail[img.prop]]" v-else/>
 | |
|           </el-form-item>
 | |
|         </el-form>
 | |
|       </ai-card>
 | |
|       <ai-card title="审核信息" v-if="!(isAdd||isEdit)">
 | |
|         <el-form-item label="审核状态">{{ dict.getLabel('auditStatus', detail.auditStatus) }}</el-form-item>
 | |
|         <el-form-item label="审核时间">{{ detail.auditTime }}</el-form-item>
 | |
|         <el-form-item label="审核人">{{ detail.auditName }}</el-form-item>
 | |
|         <el-form-item label="保单订单号">{{ detail.orderNo }}</el-form-item>
 | |
|         <el-form-item label="保单资料">
 | |
|           <el-image :src="detail.picture" :preview-src-list="[detail.picture]"/>
 | |
|         </el-form-item>
 | |
|         <el-form-item label="说明">{{ detail.remarks }}</el-form-item>
 | |
|       </ai-card>
 | |
|     </el-form>
 | |
|     <div slot="footer">
 | |
|       <template v-if="isAdd||isEdit">
 | |
|         <el-button type="primary" @click="submit">保存草稿</el-button>
 | |
|         <el-button type="primary" @click="submit">保存并提交</el-button>
 | |
|       </template>
 | |
|       <el-button @click="back">返回</el-button>
 | |
|     </div>
 | |
|   </ai-page>
 | |
| </template>
 | |
| 
 | |
| <style scoped lang="scss">
 | |
| .iaAdd {
 | |
| }
 | |
| </style>
 |