居民档案调整完成
This commit is contained in:
		| @@ -1,9 +1,18 @@ | |||||||
| <template> | <template> | ||||||
|   <section class="AiEditCard"> |   <section class="AiEditCard"> | ||||||
|     <ai-card v-bind="{...$props,...$attrs}"> |     <ai-card v-bind="{...$props,...$attrs}"> | ||||||
|  |       <template v-if="showBtn" #right> | ||||||
|  |         <template v-if="edit"> | ||||||
|  |           <el-button type="text" @click="handleCancel">取消</el-button> | ||||||
|  |           <el-button type="text" @click="handleSave">保存</el-button> | ||||||
|  |         </template> | ||||||
|  |         <template v-else> | ||||||
|  |           <el-button type="text" icon="iconfont iconEdit" @click="edit=true">修改</el-button> | ||||||
|  |         </template> | ||||||
|  |       </template> | ||||||
|       <template #content> |       <template #content> | ||||||
|         <slot name="edit"/> |         <slot v-if="edit" name="edit"/> | ||||||
|         <slot/> |         <slot v-else/> | ||||||
|       </template> |       </template> | ||||||
|     </ai-card> |     </ai-card> | ||||||
|   </section> |   </section> | ||||||
| @@ -13,15 +22,29 @@ | |||||||
| export default { | export default { | ||||||
|   name: "AiEditCard", |   name: "AiEditCard", | ||||||
|   props: { |   props: { | ||||||
|     editable:{default:false} |     editable: Boolean, | ||||||
|  |     showBtn: {default: true} | ||||||
|   }, |   }, | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       editable: false |       edit: false | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     handleSave() { | ||||||
|  |       if (this.$listeners.save) { | ||||||
|  |         this.$emit('save', () => this.edit = false) | ||||||
|  |       } else this.edit = false | ||||||
|  |     }, | ||||||
|  |     handleCancel() { | ||||||
|  |       if (this.$listeners.cancel) { | ||||||
|  |         this.$emit('cancel') | ||||||
|  |         this.edit = false | ||||||
|  |       } else this.edit = false | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   methods: {}, |  | ||||||
|   created() { |   created() { | ||||||
|  |     this.edit = this.editable | ||||||
|   } |   } | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user