123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- //取得用户真实名字
- var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //部门id
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //部门名称
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- //父部门id
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var resetValue={};
- var flagAdd_Edit;
-
- //属性树的初始值
- var Dname;
- var DnameShow;
-
-
- function initComplete(){
-
- /**************************************录入人信息***************************************/
- //取登录用户信息
- //登录用户姓名
- var userName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- $("#REAL_NAME_880").html(userName);
- //用户手机号
- var getMobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
- if(getMobile==undefined){
- $("#MOBILE_880").html("暂无手机号码");
- }else{
- $("#MOBILE_880").html(getMobile);
- }
- var getCorp_names = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- $("#COMPANY_ID_880").html(getCorp_names);
- //用户所属部门
- var getDeptnames = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- $("#ORG_ID_880").html(getDeptnames);
-
-
- /**************************************end***************************************/
-
-
-
-
- //绑定表单提交按钮和重置按钮
- $("#save").bind("click",function(){
- submitInfo();
- });
-
- $("#cancel").bind("click",function(){
- reset_input();
- });
-
- $("#goback").bind("click",function(){
- goBack();
- });
-
- var iframe = parent.document.getElementById("frmright");
- var iframeUrl = iframe.src;
- if (iframeUrl.indexOf('?') > -1) {
- flagAdd_Edit="edit";
- /***
- 单位部门树形结构
- */
- // var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
- // $.post(deptUrl,{id:parentId,name:''},function(data){
- // $("#SUP_UNIT_220").data("data",data);
- // $("#SUP_UNIT_220").render();
- // }, "json");
-
-
- //判定修改--》更新界面显示的信息
- document.getElementById("basetitle").innerHTML = "修改应急基地信息";
- var fd_id = (iframeUrl).split('?')[1];
- var url = $.pathname() + "/ws/crud/CRUDService/getDataById/";
- var params = {
- classid : '220',
- objectID : fd_id
- };
- $('#fileDiv').newAsyncFileUpload("",fd_id,1);
- /* ajax请求 */
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data) {
- $("#shijian").attr("style","show");
- resetValue=data;
- $('#baseFillForm').ajaxWrite({
- data : data
- });
- //设定联动部门树形下拉框的值
- // Dname = data.SUP_UNIT_220;
- // DnameShow = data.SUP_UNIT_220_SHOW;
-
- //加载树的赋值
- // $("#SUP_UNIT_220").attr("relValue",Dname);
- // $("#SUP_UNIT_220").attr("relText",DnameShow);
- // $("#SUP_UNIT_220").find("input:text").val(DnameShow);
-
- $("#SUP_UNIT").val(data.SUP_UNIT_220_SHOW);
-
- $('#baseFillForm input[name="classid"]').val('220');
- $("#UPDATEDATE").html(data.UPDATEDATE_220);
-
- },
- error : function(e) {
- top.Dialog.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- } else {
- flagAdd_Edit="add";
- /***
- 单位部门树形结构
- */
- // var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
- // $.post(deptUrl,{id:parentId,name:''},function(data){
- // $("#SUP_UNIT_220").data("data",data);
- // $("#SUP_UNIT_220").render();
- // }, "json");
- $("#SUP_UNIT").val(getCorp_names);
- var compid = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- $("#SUP_UNIT_220").val(compid);
- //附件
- $('#fileDiv').newAsyncFileUpload("",null,1);
- document.getElementById("basetitle").innerHTML = "新增应急基地信息";
-
-
- }
- /*//给附件重命名
- document.getElementByTagName("legend")[0].innerHTML="上传培训资料附件";*/
-
- $("#goback").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
- }
- // 设定新增与修改的界面和方法 --点击保存按钮后触发事件
- function submitInfo() {
- if (flagAdd_Edit=="edit") {
- editValidate();
- }
- if (flagAdd_Edit=="add") {
- addValidate();
- }
- };
- //新增表单验证
- function addValidate() {
- // function exValid(){
- // if($("#BASE_NAME_220").val().trim()!=""||null==$("#BASE_NAME_220").val().trim()){
- // return true;
- // }else{
- // return false;
- // }
- // }
- var valid = $("#baseFillForm").validationEngine({
- returnIsValid : true,
- });
-
- if (valid == true) {
- if(hasFile()==false){
- top.Dialog.alert("请选择上传的文件!");
- return;
- }
- addfn();
- } else {
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //修改表单验证
- function editValidate() {
- var valid = $("#baseFillForm").validationEngine({
- returnIsValid : true,
- });
- if (valid == true) {
- if(hasFile()==false){
- top.Dialog.alert("请选择上传的文件!");
- return;
- }
- editfn();
- } else {
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- //系统方法重写--文件上传
- function fileToSave($form,listGrid,msg){
- showProgressBar("正在提交中...");
- //表单异步提交处理
- $form.ajaxSubmit({
- url:$.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad",
- //表单提交成功后的回调
- success: function(responseText, statusText, xhr, $form){
- responseText = eval('('+responseText+')');
- top.Dialog.close();//关闭窗口
- closeProgress();
-
- if(msg!=undefined){
- if(responseText.info == 'success'){
- top.Dialog.alert(msg+'成功!');//弹出提示
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.html";
-
- }else{
- top.Dialog.alert(msg+'失败!');//弹出提示
- }
- }else{
- if(responseText.info == 'success'){
-
- top.Dialog.alert('保存成功!');//弹出提示
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.html";
- }else{
-
- top.Dialog.alert('保存失败!');//弹出提示
- }
- }
- //listGrid.setNewPage(1);//页号设置为第一页
- //listGrid.loadData();//刷新列表
- }
- });
- }
- //系统方法重写修改
- function fileToupdate($form,listGrid,msg){
- showProgressBar("正在提交中...");
- // 表单异步提交处理
- $form.ajaxSubmit({
- url:$.pathname() +"/ws/uploadForm/FileUpDownService/editlocation",
- // 表单提交成功后的回调
- success: function(responseText, statusText, xhr, $form){
- responseText = eval('('+responseText+')');
- top.Dialog.close();// 关闭窗口
- closeProgress();
- if(msg!=undefined){
- if(responseText.info == 'success'){
- top.Dialog.alert(msg+'成功!');//弹出提示
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.html";
-
- }else{
- top.Dialog.alert(msg+'失败!');//弹出提示
- }
- }else{
- if(responseText.info == 'success'){
-
- top.Dialog.alert('保存成功!');//弹出提示
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.html";
- }else{
-
- top.Dialog.alert('保存失败!');//弹出提示
- }
- }
- listGrid.setNewPage(1);// 页号设置为第一页
- listGrid.loadData();// 刷新列表
- }
- });
- }
- //修改事件
- function editfn() {
- $("body").eq(0).showLoading();
- var $form=$("#baseFillForm");
- //var url = $.pathname() +"/ws/uploadForm/FileUpDownService/editlocation";
- // fileToupdate($form,null,null);
- var formValue = $form.serialize();
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $.request.add(url,formValue,function(data){
- $("body").eq(0).hideLoading();
- $.messager.alert("修改成功",null,null,null,-1);
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.jsp";
- });
- };
- //新增事件
- function addfn() {
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- $('#RESERVE_ONE_220').val(userId);
- $("body").eq(0).showLoading();
- var $form=$("#baseFillForm");
- //var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
- // fileToSave($form,null,null);
- var formValue = $form.serialize();
- var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
- $.request.add(url,formValue,function(data){
- $("body").eq(0).hideLoading();
- $.messager.alert("新增成功",null,null,null,-1);
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.jsp";
- });
- };
- //返回按钮 返回到外部机构列表
- function goBack() {
- var iframe = parent.document.getElementById("frmright");
- iframe.src = "business/am/base/am-base.jsp";
- }
- function reset_input(){
- document.location.reload();
- // $("#BASE_NAME_220").val(resetValue.BASE_NAME_220);
- // $("#BASE_ADDRESS_220").val(resetValue.BASE_ADDRESS_220);
- // $("#TEAM_NUMBER_220").val(resetValue.TEAM_NUMBER_220);
- // $("#LONGITUDE_220").val(resetValue.LONGITUDE_220);
- // $("#LATITUDE_220").val(resetValue.LATITUDE_220);
- // $("#EQUIPMENT_TYPE_220").val(resetValue.EQUIPMENT_TYPE_220);
- // $("#EQUIPMENT_NUM_220").val(resetValue.EQUIPMENT_NUM_220);
- // //重置联动部门
- // $("#SUP_UNIT_220").attr("relValue",Dname);
- // $("#SUP_UNIT_220").attr("relText",DnameShow);
- // $("#SUP_UNIT_220").find("input:text").val(DnameShow);
-
- }
- $.messager=top.Dialog;
|