refactor(xumu): 移除表单照片的验证规则
移除了 AppDeathManage 和 AppOutManage 组件中照片上传的验证规则。这个改动统一了照片上传的规则,提高了代码的一致性和可维护性。 受影响的主要文件: - project/xumu/AppDeathManage/add.vue - project/xumu/AppOutManage/add.vue 具体改动: - 删除了 formImages 数组中每个对象的 rules 属性 - 优化了部分代码格式,如空格和换行
This commit is contained in:
		| @@ -3,10 +3,10 @@ import {mapState} from "vuex" | ||||
| import AiEartagRemote from "@project/xumu/components/AiEartagRemote.vue"; | ||||
|  | ||||
| const formImages = [ | ||||
|   {label: "身长测量照片", prop: "heightPic", rules: {required: true, message: '请上传 身长测量照片'}}, | ||||
|   {label: "生物芯片照片", prop: "biochipPic", rules: {required: true, message: '请上传 生物芯片照片'}}, | ||||
|   {label: "防疫耳标照片", prop: "preventionPic", rules: {required: true, message: '请上传 防疫耳标照片'}}, | ||||
|   {label: "其他说明照片", prop: "otherPic", rules: {required: true, message: '请上传 其他说明照片'}}, | ||||
|   {label: "身长测量照片", prop: "heightPic",}, | ||||
|   {label: "生物芯片照片", prop: "biochipPic",}, | ||||
|   {label: "防疫耳标照片", prop: "preventionPic",}, | ||||
|   {label: "其他说明照片", prop: "otherPic",}, | ||||
| ] | ||||
| export default { | ||||
|   name: "deathAdd", | ||||
| @@ -89,7 +89,7 @@ export default { | ||||
|     <el-form size="small" label-width="120px" :model="detail" ref="detail"> | ||||
|       <ai-card title="基础信息"> | ||||
|         <div class="grid c-4"> | ||||
|           <ai-eartag-remote :instance="instance" @enter="handlerAutocomplete" /> | ||||
|           <ai-eartag-remote :instance="instance" @enter="handlerAutocomplete"/> | ||||
|           <el-form-item label="生物芯片耳标号"> | ||||
|             <b v-text="detail.biochipEarNumber"/> | ||||
|           </el-form-item> | ||||
|   | ||||
| @@ -1,12 +1,12 @@ | ||||
| <script> | ||||
| import { mapState } from "vuex" | ||||
| import {mapState} from "vuex" | ||||
| import AiEartagRemote from "@project/xumu/components/AiEartagRemote.vue"; | ||||
|  | ||||
| const formImages = [ | ||||
|   { label: "身长测量照片", prop: "heightPic", rules: { required: true, message: '请上传 身长测量照片' } }, | ||||
|   { label: "生物芯片照片", prop: "biochipPic", rules: { required: true, message: '请上传 生物芯片照片' } }, | ||||
|   { label: "防疫耳标照片", prop: "preventionPic", rules: { required: true, message: '请上传 防疫耳标照片' } }, | ||||
|   { label: "其他说明照片", prop: "otherPic", rules: { required: true, message: '请上传 其他说明照片' } }, | ||||
|   {label: "身长测量照片", prop: "heightPic",}, | ||||
|   {label: "生物芯片照片", prop: "biochipPic",}, | ||||
|   {label: "防疫耳标照片", prop: "preventionPic",}, | ||||
|   {label: "其他说明照片", prop: "otherPic",}, | ||||
| ] | ||||
| export default { | ||||
|   name: "outAdd", | ||||
| @@ -40,7 +40,7 @@ export default { | ||||
|       this.$router.push(params) | ||||
|     }, | ||||
|     getDetail(id) { | ||||
|       return id && this.instance.post("/api/breed/out/page", { biochipEarNumber: id }).then(res => { | ||||
|       return id && this.instance.post("/api/breed/out/page", {biochipEarNumber: id}).then(res => { | ||||
|         if (res?.data?.records) { | ||||
|           const detail = res.data.records[0] || {} | ||||
|           if (detail.picture) { | ||||
| @@ -48,15 +48,15 @@ export default { | ||||
|               detail[key] = value | ||||
|             }) | ||||
|           } | ||||
|           return this.detail = { ...detail } | ||||
|           return this.detail = {...detail} | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     submit() { | ||||
|       this.$refs.detail.validate().then(() => { | ||||
|         const { biochipEarNumber, id, outTime, heightPic, biochipPic, preventionPic, otherPic, reason, remarks } = this.detail | ||||
|         const {biochipEarNumber, id, outTime, heightPic, biochipPic, preventionPic, otherPic, reason, remarks} = this.detail | ||||
|         this.instance.post("/api/breed/out/addOrEdit", { | ||||
|           biochipEarNumber, id, outTime, picture: { heightPic, biochipPic, preventionPic, otherPic }, reason, remarks | ||||
|           biochipEarNumber, id, outTime, picture: {heightPic, biochipPic, preventionPic, otherPic}, reason, remarks | ||||
|         }).then(res => { | ||||
|           if (res?.code == 0 && res?.data != 1) { | ||||
|             this.$confirm("是否返回列表页?", "提交成功").then(() => this.back()).catch(() => this.getDetail(biochipEarNumber)) | ||||
| @@ -66,8 +66,8 @@ export default { | ||||
|     }, | ||||
|     handleAudit() { | ||||
|       this.$refs.form.validate().then(() => { | ||||
|         const { id } = this.detail | ||||
|         this.instance.post("/api/breed/out/audit", null, { params: { id, ...this.form } }).then(res => { | ||||
|         const {id} = this.detail | ||||
|         this.instance.post("/api/breed/out/audit", null, {params: {id, ...this.form}}).then(res => { | ||||
|           if (res?.code == 0) { | ||||
|             this.$message.success("操作成功") | ||||
|             this.back() | ||||
| @@ -91,53 +91,53 @@ export default { | ||||
|     <el-form size="small" label-width="120px" :model="detail" ref="detail"> | ||||
|       <ai-card title="基础信息"> | ||||
|         <div class="grid c-4"> | ||||
|           <ai-eartag-remote :instance="instance" @enter="handlerAutocomplete" /> | ||||
|           <ai-eartag-remote :instance="instance" @enter="handlerAutocomplete"/> | ||||
|           <el-form-item label="生物芯片耳标号"> | ||||
|             <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="originalEarNumber"> | ||||
|             <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> | ||||
|       </ai-card> | ||||
|       <ai-card title="上传照片"> | ||||
|         <div class="grid c-4"> | ||||
|           <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 /> | ||||
|             <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> | ||||
|         </div> | ||||
|       </ai-card> | ||||
|       <ai-card title="淘汰录入"> | ||||
|         <div class="grid"> | ||||
|           <el-form-item label="淘汰日期" prop="outTime" :rules="[{ required: true, message: '请选择淘汰日期' }]"> | ||||
|             <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-if="isAdd || isEdit" v-model="detail.outTime" /> | ||||
|             <b v-else v-text="detail.outTime" /> | ||||
|             <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-if="isAdd || isEdit" v-model="detail.outTime"/> | ||||
|             <b v-else v-text="detail.outTime"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="淘汰原因" prop="reason" :rules="[{ required: true, message: '请选择淘汰原因' }]"> | ||||
|             <ai-select v-if="isAdd || isEdit" v-model="detail.reason" dict="outReason" /> | ||||
|             <b v-else v-text="detail.reason" /> | ||||
|             <ai-select v-if="isAdd || isEdit" v-model="detail.reason" dict="outReason"/> | ||||
|             <b v-else v-text="detail.reason"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="备注" prop="remark" class="row"> | ||||
|             <ai-input type="textarea" :row="3" v-model="detail.remark" :edit="isAdd || isEdit" /> | ||||
|             <ai-input type="textarea" :row="3" v-model="detail.remark" :edit="isAdd || isEdit"/> | ||||
|           </el-form-item> | ||||
|         </div> | ||||
|       </ai-card> | ||||
| @@ -145,10 +145,10 @@ export default { | ||||
|         <el-form :model="form" size="small" ref="form" label-width="120px"> | ||||
|           <el-form-item label="是否同意" prop="auditStatus" :rules="[{ required: true, message: '请选择是否同意' }]"> | ||||
|             <ai-select v-model="form.auditStatus" | ||||
|               :select-list="[{ dictValue: 2, dictName: '同意' }, { dictValue: 3, dictName: '不同意' }]" /> | ||||
|                        :select-list="[{ dictValue: 2, dictName: '同意' }, { dictValue: 3, dictName: '不同意' }]"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="审批意见" prop="auditReason"> | ||||
|             <el-input type="textarea" :row="3" v-model="form.auditReason" clearable placeholder="请输入" /> | ||||
|             <el-input type="textarea" :row="3" v-model="form.auditReason" clearable placeholder="请输入"/> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|       </ai-card> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user