123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- //IE屏蔽退格键
- document.onkeydown =function (e) {
- var bancode,bantype;
- if (!e){ var e = window.event;}
- if (e.keyCode){ bancode = e.keyCode;}
- else if (e.which){ bancode = e.which;}
- bantype = event.srcElement.bantype;
- if ((bancode == 8)
- && ((bantype == "text" && bantype == "textarea" ) || event.srcElement.readOnly == true)) {
- event.keyCode = 0;
- event.returnValue = false;
- }
- return true;
- };
- $(function() {
- //获得树节点的objectId用于加载机构信息
- fd_id_org = parent.sup_fd_objectId;
- //获得机构名称 用于查询筛选条件
- org_name_org = parent.sup_org_name;
- if(fd_id_org == "objectid"||null==fd_id_org){
- //更新界面显示--界面title(机构名称)
- document.getElementById("org_info_span").innerHTML = org_name_org;
- //隐藏按钮
- document.getElementById("am_org_img").style.display = "none";
- document.getElementById("option_tr").style.display = "none";
- //隐藏 “修改”按钮
- document.getElementById("update_orgInfo").style.display = "none";
- }else{
- //初始化界面
- init_orgInfo();
- }
- });
- //初始化机构的详细信息
- function init_orgInfo() {
- //更新界面显示--界面title(机构名称)
- document.getElementById("org_info_span").innerHTML = org_name_org;
- //隐藏按钮
- document.getElementById("am_org_img").style.display = "none";
- document.getElementById("option_tr").style.display = "none";
- //加载机构信息显示
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '212',
- objectID : fd_id_org
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data) {
- $("#fillForm").ajaxWrite({
- data : data
- });
- $("#fillForm input[name='classid']").val("212");
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- //修改按钮操作
- function update_operator() {
- //显示 “返回”图标 “保存” “重置”按钮
- document.getElementById("am_org_img").style.display = "";
- document.getElementById("option_tr").style.display = "";
- //隐藏 “修改” “删除”按钮
- document.getElementById("update_orgInfo").style.display = "none";
- /*document.getElementById("delete_orgInfo").style.display = "none";*/
- //将只读样式去掉
- var readOnly_input = document.getElementsByTagName("input");
- for (var i = 0; i < readOnly_input.length; i++) {
- readOnly_input[i].readOnly = false;
- }
- }
- //删除机构事件
- function delete_operator() {
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- // 删除记录
- $.post($.pathname() + "/ws/crud/CRUDService/delete/", {
- "objectIDs" : fd_id_org,
- classid : 212
- }, function(result) {
- if (result.Msg.sucsess == true) {
- $.messager.alert("删除成功", null, null, null, 1);
- //清空界面
- document.getElementById("fillForm").setAttribute("style",
- "none");
- } else {
- top.Dialog.alert("删除失败!");
- }
- }, "json");
- });
- document.getElementById("fillForm").setAttribute("style", "none");
- }
- //修改事件--表单提交时触发
- function save_orgInfo() {
- //验证表单
- editValidate();
- }
- //表单验证
- function editValidate() {
- var valid = $("#fillForm").validationEngine({
- returnIsValid : true,
- });
- if (valid == true) {
- editfn();
- } else {
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //修改机构信息--发送请求后台交互
- function editfn() {
- $form = $("#fillForm");
- var formValue = $form.serialize();
- $("#classid").val("212");
- var url = $.pathname() + "/ws/crud/CRUDService/update/";
- //先修改机构名称
- updateOrgName();
- //再修改全部内容
- $.ajax({
- url : url,
- type : "post",
- timeout : 60000,
- data : formValue,
- dataType : "json",
- success : function(data) {
- //刷新树的名称
- var newOutTreeName=$("#ORG_DEPT_NAME_212").val();
- parent.refreshMytree2Node(newOutTreeName);
- top.Dialog.alert("修改成功,返回列表");
- goBack();
- },
- error : function() {
- top.Dialog.alert("修改失败,稍后再试...");
- }
- });
- }
- //返回图标单击事件 --重新加载界面
- function goBack() {
- location.reload();
- }
-
- //修改机构名称
- function updateOrgName(){
- var params={"deptId":fd_id_org,
- "deptName":$("#ORG_DEPT_NAME_212").val()
- };
- $.ajax({
- url:$.pathname() + "/ws/orgOutDeptService/OrgOutDeptService/editOrgOutDept/",
- type:"post",
- data:params,
- dataType:"json",
- success:function(data){
-
- if(data.msg=="success"){
- return true;
-
- };
- if(data.msg=="fail"){
- return false;
- };
-
- },
- error:function(){
-
- return false;
- }
- });
-
- }
|