| <template>  | 
|   <a-form style="margin-top: 8px">  | 
|     <a-modal  | 
|       title="编辑-字典类型"  | 
|       destroyOnClose  | 
|       :visible="visible"  | 
|       @cancel="handleCancel"  | 
|       @ok="handleOk"  | 
|       okText="保存"  | 
|     >  | 
|       <a-form style="margin-top: 8px">  | 
|         <a-form-item  | 
|           :labelCol="{ span: 5 }"  | 
|           :wrapperCol="{ span: 15 }"  | 
|           label="字典类型"  | 
|   | 
|         >  | 
|           <a-input  v-model="editdictionarytype.name" disabled />  | 
|         </a-form-item>  | 
|         <a-form-item  | 
|           :labelCol="{ span: 5 }"  | 
|           :wrapperCol="{ span: 15 }"  | 
|           label="字典描述"  | 
|   | 
|         >  | 
|           <a-input placeholder="请输入电话" v-model="editdictionarytype.desc" />  | 
|         </a-form-item>  | 
|   | 
|       </a-form>  | 
|     </a-modal>  | 
|   </a-form>  | 
| </template>  | 
|   | 
| <script lang="ts">  | 
| import {  | 
|   Component,  | 
|   Prop,  | 
|   Vue,  | 
|   Emit,  | 
|   Model,  | 
|   Watch  | 
| } from "vue-property-decorator";  | 
| import { State, Mutation, namespace } from "vuex-class";  | 
|   | 
| import { get, post } from "@/util/request";  | 
|   | 
| @Component({  | 
|   components: {}  | 
| })  | 
| export default class UpdateDictionaryType extends Vue {  | 
|   private editdictionarytype: any = {  | 
|     name: null,  | 
|     desc: null,  | 
|     id:null  | 
|   };  | 
|   @Prop({  | 
|     type: Boolean,  | 
|     default: false  | 
|   })  | 
|   private visible!: boolean;  | 
|   | 
|   @Prop({  | 
|     type: Object,  | 
|     default() {  | 
|       return {};  | 
|     }  | 
|   })  | 
|   private record!: any;  | 
|   | 
|   private handleCancel(): void {  | 
|     this.editdictionarytype.desc = this.record.desc;  | 
|     this.updateVisible(false);  | 
|   }  | 
|   // 保存 更新数据库  | 
|   private handleOk(): void {  | 
|     post("dict/type/update", {  | 
|            id:this.editdictionarytype.id,  | 
|          desc:this.editdictionarytype.desc  | 
|         }).then(res => {  | 
|         if(res.data.code!=0){  | 
|           this.$message.error(res.data.message);  | 
|         }else{  | 
|         //保存成功,组件刷新数据  | 
|         this.$emit("updateData");  | 
|         this.$message.success(res.data.message)  | 
|         this.updateVisible(false);  | 
|         }  | 
|       })  | 
|       .catch(err => {  | 
|         console.log(err);  | 
|       });  | 
|   }  | 
|   | 
|   private updateVisible(visible: boolean): void {  | 
|     this.$emit("update:visible", visible);  | 
|   }  | 
|   | 
|   //监听编辑回调值  | 
|   @Watch("record", {  | 
|     immediate: true, //监听开始后是否立即调用该回调函数;  | 
|     deep: true //深度监听  | 
|   })  | 
|   //监听编辑逻辑赋值  | 
|   private recordChange(value: any, oldValue: any): void {  | 
|     this.editdictionarytype.name = this.record.name;  | 
|     this.editdictionarytype.desc = this.record.desc;  | 
|     this.editdictionarytype.id=this.record.id  | 
|   }  | 
| }  | 
| </script>  |