var AdminiDepartment={EditSame:{ElemAssembly:{Post:{"名称":0},Other:{"提交按钮":0}},DataAssembly:{Post:{"名称":"",ID:"00000000-0000-0000-0000-000000000000"},Backup:{"名称":"","操作类型":""}},Handle:{Type:{"本地添加":"本地添加","引用添加":"引用添加","本地修改":"本地修改"},name:function(){return AdminiDepartment.EditSame.DataAssembly.Backup.操作类型=="本地修改"?"修改":"创建"},embedBoxyHide:function(){parent&&parent.AdminiEmbedHandle&&parent.AdminiEmbedHandle.Department.Boxy.hide()},embedBoxyBtn:function(a){switch(AdminiDepartment.EditSame.DataAssembly.Backup.操作类型){case"引用添加":case"本地修改":parent&&parent.AdminiEmbedHandle&&parent.AdminiEmbedHandle.Department.Boxy.setCloseVis(a)}},completed:function(a,b){switch(AdminiDepartment.EditSame.DataAssembly.Backup.操作类型){case"本地添加":AdminiDepartment.EditSame.ElemAssembly.Post.名称.val("").focus();break;case"引用添加":parent&&parent.AdminiEmbedHandle&&parent.AdminiEmbedHandle.Department.Update.dropdown(a,b);break;case"本地修改":parent&&parent.AdminiEmbedHandle&&parent.AdminiEmbedHandle.Department.Update.list({waitType:"正在更新"})}}},initData:function(b,d){this.DataAssembly.Post.ID=b;this.DataAssembly.Backup.名称=d;var c=Global.URL.routes();if(c.action=="IFrame")if(b!=Global.Guid.empty())this.DataAssembly.Backup.操作类型=this.Handle.Type.本地修改;else this.DataAssembly.Backup.操作类型=this.Handle.Type.引用添加;else this.DataAssembly.Backup.操作类型=this.Handle.Type.本地添加;var a=this.ElemAssembly;Global.LoadIng.ready(function(){var c=$("#名称"),b=$("#提交按钮");a.Post.名称=c;a.Other.提交按钮=b;Global.Object.Tag.inputFS(c);Global.AccessKey.KeyDown.enter(function(){Global.Object.Tag.onClick(b)})})},Format:{"名称":function(c){var e=AdminiDepartment.EditSame,f=e.DataAssembly,a=e.ElemAssembly.Post.名称,b=a.val().trim(),d=Global.Environment.get部门名称();if(b==""){Global.Object.htmlElemFocus(a);Global.CallBack.false_3(c,"请输入"+d+"名称！",a)}else if(b.length>16){Global.Object.htmlElemFocus(a);Global.CallBack.false_3(c,d+"名称长度不能大于16位！",a)}else if(f.Backup.名称==b){Global.Object.htmlElemFocus(a);Global.CallBack.false_3(c,d+"名称还没有修改过",a)}else Global.CallBack.true_1(c,b)}},postAjax:function(c){var d="Admini-Add-Department",e=Global.Boxy.Topics.Admin.department(c.名称),b=AdminiDepartment.EditSame.Handle,a=b.name();b.embedBoxyBtn(false);Global.Boxy.wait(d,{newTitle:a,dtHtml:a+e,triggerBtn:AdminiDepartment.EditSame.ElemAssembly.Other.提交按钮});Global.AjaxServer.Post.json("/Department/UCEditor/",c,function(f){if(f.result)Global.Boxy.success(d,{newTitle:a+"成功",dtHtml:e+"已"+a+"成功.",boxyOptions:{beforeHide:function(){b.embedBoxyHide()},afterHide:function(){b.completed(f.info.ID,f.info.名称)}}});else{b.embedBoxyBtn(true);Global.Boxy.failure(d,{newTitle:a+"失败",dtHtml:e+a+"失败",newMessage:"名称为“"+c.名称+"”的"+Global.Environment.get部门名称()+"已存在，请重新填写！",boxyOptions:{afterHide:function(){AdminiDepartment.EditSame.ElemAssembly.Post.名称.select()}}})}})},submit:function(){Global.MsgBox.submit(this,["名称"])}}}