风险预警
This commit is contained in:
		
							
								
								
									
										155
									
								
								packages/jianping/AppRiskWarning/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										155
									
								
								packages/jianping/AppRiskWarning/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,155 @@ | ||||
| <template> | ||||
|   <ai-detail> | ||||
|     <template slot="title"> | ||||
|       <ai-title :title="params.id ? '编辑风险人员' : '添加风险人员'" isShowBack isShowBottomBorder @onBackClick="cancel(false)"> | ||||
|       </ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-card title="基本信息"> | ||||
|         <template #content> | ||||
|           <el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right"> | ||||
|             <el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名', trigger: 'blur' }]"> | ||||
|               <el-input v-model="form.name" size="small" placeholder="请输入姓名"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="联系方式" prop="phone" :rules="[{ required: true, validator: validatorPhone, trigger: 'blur' }]"> | ||||
|               <el-input v-model="form.phone" :maxlength="11" size="small" placeholder="请输入..."></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="风险类型" prop="idNumber" :rules="[{ required: true, message: '请选择风险类型', trigger: 'blur' }]"> | ||||
|               <ai-select | ||||
|                 v-model="form.checkResult" | ||||
|                 clearable | ||||
|                 placeholder="请选择风险类型" | ||||
|                 :selectList="dict.getDict('epidemicRecentTestResult')"> | ||||
|               </ai-select> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="身份证号" prop="idNumber" :rules="[{ required: true, validator: validatorId, trigger: 'blur' }]"> | ||||
|               <el-input v-model="form.idNumber" :maxlength="20" size="small" placeholder="请输入..."></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item style="width: 100%!important;" label="所在地区" prop="areaId" :rules="[{ required: true, message: '请选择所在地区', trigger: 'change' }]"> | ||||
|               <ai-area-select | ||||
|                 v-model="form.areaId" | ||||
|                 always-show | ||||
|                 :disabled="form.applyType === '1'" | ||||
|                 :instance="$http" | ||||
|                 clearable | ||||
|                 @fullname="v=>form.areaName = v" | ||||
|                 :disabledLevel="3"/> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="联系地址" prop="idNumber" style="width: 100%;"> | ||||
|               <el-input v-model="form.idNumber" :maxlength="30" size="small" placeholder="请输入联系地址"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="备注说明" prop="idNumber" style="width: 100%;"> | ||||
|               <el-input v-model="form.idNumber" :rows="5" style="width: 100%;" type="textarea" :maxlength="500" size="small" placeholder="请输入..."></el-input> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|     <template #footer> | ||||
|       <el-button @click="cancel">取消</el-button> | ||||
|       <el-button type="primary" @click="confirm">提交</el-button> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'Add', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       const validatorId = (rule, value, callback) => { | ||||
|         if (value === '') { | ||||
|           callback(new Error('请输入身份证号')) | ||||
|         } else if (!this.idCardNoUtil.checkIdCardNo(value)) { | ||||
|           callback(new Error('身份证号格式错误')) | ||||
|         } else { | ||||
|           callback() | ||||
|         } | ||||
|       } | ||||
|  | ||||
|       const validatorPhone = function (rule, value, callback) { | ||||
|         if (value === '') { | ||||
|           callback(new Error('请输入联系方式')) | ||||
|         } else if (!/^1\d{10}$/.test(value)) { | ||||
|           callback(new Error('手机号格式错误')) | ||||
|         } else { | ||||
|           callback() | ||||
|         } | ||||
|       } | ||||
|       return { | ||||
|         info: {}, | ||||
|         validatorId, | ||||
|         validatorPhone, | ||||
|         form: { | ||||
|           title: '', | ||||
|           content: '', | ||||
|           publishUnitName: '', | ||||
|           images: [] | ||||
|         }, | ||||
|         id: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       if (this.params && this.params.id) { | ||||
|         this.id = this.params.id | ||||
|         this.getInfo(this.params.id) | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appmininotice/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form = { | ||||
|               ...res.data, | ||||
|               images: res.data.images ? JSON.parse(res.data.images) : [] | ||||
|             } | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       onClose () { | ||||
|         this.form.explain = '' | ||||
|       }, | ||||
|  | ||||
|       confirm () { | ||||
|         this.$refs.form.validate((valid) => { | ||||
|           if (valid) { | ||||
|             if (!this.form.content && !this.form.images.length) { | ||||
|               return this.$message.error('请输入正文或上传图片') | ||||
|             } | ||||
|  | ||||
|             this.instance.post(`/app/appmininotice/addOrUpdate`, { | ||||
|               ...this.form, | ||||
|               images: this.form.images ? JSON.stringify(this.form.images) : [] | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功') | ||||
|                 setTimeout(() => { | ||||
|                   this.cancel(true) | ||||
|                 }, 600) | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       cancel (isRefresh) { | ||||
|         this.$emit('change', { | ||||
|           type: 'List', | ||||
|           isRefresh: !!isRefresh | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user