You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							54 lines
						
					
					
						
							1.4 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							54 lines
						
					
					
						
							1.4 KiB
						
					
					
				| var EditDialog = function (parent) { | |
|     this.Parent = parent; | |
|     this.Org = {}; | |
| 
 | |
|     this.Setup = function () { | |
|         $("#edit-sure-btn").on("click", this.OnSureButtonClick.bind(this)); | |
|         $("#edit-cancel-btn").on("click", this.HideDialog.bind(this)); | |
|         $("#edit-close").on("click", this.HideDialog.bind(this)); | |
|     }; | |
| 
 | |
|     this.Show = function (data) { | |
|         this.Org = data; | |
| 
 | |
|         $('#edit-dialog').show(); | |
|         $("#org-name").textbox('setValue', data.Name); | |
|     }; | |
| 
 | |
|     this.OnSureButtonClick = function () { | |
|         this.validation(); | |
|     }; | |
| 
 | |
|     this.validation = function () { | |
|         if ($("#org-name").textbox('getValue').trim() === '' || $("#org-name").textbox('getValue').trim === null) { | |
|             alert('请输入机构名称'); | |
|             return | |
|         } else { | |
|             this.Org.Name = $('#org-name').textbox('getValue'); | |
| 
 | |
|             this.EditOrg(); | |
|             this.HideDialog(); | |
|         } | |
|     }; | |
| 
 | |
|     this.EditOrg = function () { | |
|         $.ajax({ | |
|             type: "POST", | |
|             dataType: 'text', | |
|             url: '/OrgManagement/Update', | |
|             data: this.Org, | |
|             success: function () { | |
|                 this.Parent.ReLoadTableData(); | |
|             }.bind(this) | |
|         }); | |
|     }; | |
| 
 | |
|     this.HideDialog = function () { | |
|         $('#edit-dialog').hide(); | |
|         this.clearInput(); | |
|     }; | |
| 
 | |
|     this.clearInput = function () { | |
|         $("#org-name").textbox('setValue', ''); | |
|     }; | |
| }; |