123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- /*//IE屏蔽退格键
- document.onkeydown =function (e) {
- var code,type;
- if (!e){ var e = window.event;}
- if (e.keyCode){ code = e.keyCode;}
- else if (e.which){ code = e.which;}
- type = event.srcElement.type;
- if ((code == 8)
- && ((type == "text" && type == "textarea" ) || event.srcElement.readOnly == true)) {
- event.keyCode = 0;
- event.returnValue = false;
- }
- return true;
- };*/
- var resetValue;
- var treeDeptId = parent.sup_fd_objectId;
- var user_id;
- $(function() {
-
- //绑定表单提交按钮和重置按钮
- $("#save").bind("click",function(){
- submitInfo();
- });
-
- $("#cancel").bind("click",function(){
- reset_input();
- });
-
- $("#goback").bind("click",function(){
- goBack();
- });
- //设置标题信息
- //设置重置存储对象
- //获取当前的iframe框的地址信息
- var iframe = parent.document.getElementsByName("frmrightChild")[0];
- var iframeUrl = iframe.src;
- var tree_fd_id = parent.sup_fd_objectId;
- var tree_pfd_id;
- var tree_pname;
- var fd_id = iframeUrl.split('?')[1];
- //user_id = iframeUrl.split('?')[2];
- if(parent.sup_fd_objectId==""||fd_id==parent.sup_fd_objectId||undefined==parent.sup_fd_objectId
- ||null==parent.sup_fd_objectId ){
- tree_pfd_id = parent.inTreeNode.parentId;
- tree_pname=parent.inTreeNode.parentName;
- }else{
-
- tree_pfd_id = parent.inParentNote.id;
- tree_pname = parent.inParentNote.name;
- }
- var url = $.pathname() + "/ws/crud/CRUDService/getDataById/";
- //显示当前机构信息
- var currentOrgName = parent.sup_org_name==""?"修改内部联系人":"修改"+parent.sup_org_name+"内部联系人";
- $("#inlinktitle").html(currentOrgName);
- var params = {
- classid : '211',
- objectID : fd_id
- };
- //给下拉框赋值--常量表中的
- $("#EMC_TYPE_211").initCanstSelect('BM_EMC_TYPE');
- $("#EMC_ROLE_211").initCanstSelect('BM_EMC_ROLE');
- /* ajax请求 */
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data) {
- //给resetValue赋值
- resetValue = data;
- $('#fillForm').ajaxWrite({
- data : data
- })
- ;
- //给不能修改的字段赋值
- $("#INLINK_INDEX_211").html(data.INLINK_INDEX_211);
- $("#PARENT_ORG").html(data.PARENT_ORG_ID_211_SHOW);
- $("#PARENT_DEPT").html(data.PARENT_DEPT_ID_211_SHOW);
- treeDeptId=data.VIRTUAL_ORG_ID_211;
- user_id =data.INLINK_INDEX_211;
- $('#fillForm input[name="classid"]').val('211');
- /*$('#fillForm input[name="PARENT_DEPT_ID_211"]').val(tree_fd_id);
- $('#fillForm input[name="PARENT_ORG_ID_211"]').val(tree_pfd_id);*/
- /*if($('#fillForm input[name="PARENT_ORG_211"]').val()==""||
- null==$('#fillForm input[name="PARENT_ORG_211"]').val()){
- $('#fillForm input[name="PARENT_ORG_211"]').val(tree_pname);
- }*/
- /*$('#fillForm input[name="PARENT_ORG_ID_211"]').val(tree_fd_id);*/
- /*//给下拉框赋值
- $("#EMC_TYPE_211").attr("selectedValue",data.EMC_TYPE_211);
- $("#EMC_ROLE_211").attr("selectedValue", data.EMC_ROLE_211);*/
-
- //设定上级部门和上级单位不可更改
- document.getElementById("PARENT_DEPT_211").readOnly = true;
- document.getElementById("PARENT_ORG_211").readOnly = true;
- //document.getElementById("ORG_NAME_211").readOnly = true;
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- });
- //点击保存按钮后触发的事件
- function submitInfo() {
- editValidate();
- };
- // 表单验证
- function editValidate() {
- var valid = $("#fillForm").validationEngine({
- returnIsValid : true,
- });
- if (valid == true) {
- editfn();
- } else {
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //修改事件ajax请求
- function editfn() {
- /*alert("电话号码"+$("#MYPHONE_211").val());*/
- $form = $("#fillForm");
- var formValue = $form.serialize();
- $("#classid").val("211");
- var url = $.pathname() + "/ws/crud/CRUDService/update/";
- $.ajax({
- url : url,
- type : "post",
- timeout : 60000,
- data : formValue,
- dataType : "json",
- success : function(data) {
-
- //更新角色数据
- updateRole();
- /*top.Dialog.alert("修改成功");
- goBack();*/
- },
- error : function() {
- top.Dialog.alert("修改失败,请稍后");
- }
- });
- };
- //更新角色
- function updateRole(){
- var url=$.pathname()+"/ws/OrganizationsService/OrganizationsService/updateInlinkRole";
- var roleId = $("#EMC_ROLE_211").val();
- var params={
- "deptId":treeDeptId,
- "userId":user_id,
- "roleId":transform(roleId)
-
- };
- $.ajax({
- url : url,
- type : "post",
- timeout : 60000,
- data : params,
- dataType : "json",
- success : function(data) {
-
- top.Dialog.alert("修改成功");
- goBack();
- },
- error : function() {
- top.Dialog.alert("修改失败,请稍后");
- }
- });
-
- }
- function transform(role){
- return "R00210543020"+role;
-
- }
- //点击返回图标事件返--》返回到内部联系人列表
- function goBack() {
- var iframe = parent.document.getElementsByName("frmrightChild")[0];
- iframe.src = "inlinklist.html";
- }
- //重置按钮
- function reset_input(){
- $("#INLINK_NAME_211").val(resetValue.INLINK_NAME_211);
- $("#EMC_ROLE_211").resetValue();
- $("#EMC_TYPE_211").resetValue();
- $("#JOB_211").val(resetValue.JOB_211);
- $("#MANAGER_DEPT_211").resetValue();
- $("#PHONE_211").val(resetValue.PHONE_211);
- $("#LANDLINE_211").val(resetValue.LANDLINE_211);
- $("#EMAIL_211").val(resetValue.EMAIL_211);
- }
|