123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- /**
- *角色管理
- *
- */
- $.namespace("jdjc.detail");
- jdjc.detail.init=function(set,jyrset){
- $.fn.zTree.init($("#usertree"), set);
- $.fn.zTree.init($("#jyrtree"), jyrset);
- }
- jdjc.detail.back=function(){
- location.href=$.app+"/jdjc/main";
- }
- vae = function(a, b) {
- if (isEmpty(a.val())) {
- ts(b + "不能为空", a);
- return false;
- }
- return true;
- };
- jdjc.detail.save=function(){
- // 验证必填字段是否为空
- if(vae($('#szdsel select'),"所在地")==false){return false;}
- if(vae($('#gksel select'),"港口")==false){return false;}
- if(vae($('#gqsel select'),"港区")==false){return false;}
- if(vae($('#zgqx'), "整改期限 ")==false){return false;}
- if(vae($('#jyrmc'),"被督查单位")==false){return false;}
-
- $(".btn").attr("disabled",true);
- $.ajax({
- url:$.app+"/jdjc/save",
- data:$("#addform").serialize(),
- type:"post",
- async:false,
- dataType:"json",
- success:function(data){//ajax返回的数据
- if (data.success) {
- $.alert({
- title: '提示',
- content: '操作成功',
- confirm: function(){
- location.href=$.app+'/jdjc/main';
- }
- });
- }else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
- $(".btn").attr("disabled",false);
- }
- });
- }
- }
- });
- };
- jdjc.detail.savexf=function(){
- // 验证必填字段是否为空
- if(vae($('#szdsel select'),"所在地")==false){return false;}
- if(vae($('#gksel select'),"港口")==false){return false;}
- if(vae($('#gqsel select'),"港区")==false){return false;}
- if(vae($('#zgqx'), "整改期限 ")==false){return false;}
- if(vae($('#jyrmc'),"被督查单位")==false){return false;}
-
- $(".btn").attr("disabled",true);
- $.ajax({
- url:$.app+"/jdjc/savexf",
- data:$("#addform").serialize(),
- type:"post",
- async:false,
- dataType:"json",
- success:function(data){//ajax返回的数据
- if (data.success) {
- $.alert({
- title: '提示',
- content: '操作成功',
- confirm: function(){
- location.href=$.app+'/jdjc/main';
- }
- });
- }else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
- $(".btn").attr("disabled",false);
- }
- });
- }
- }
- });
- };
- jdjc.detail.submit=function(){
- // 验证必填字段是否为空
- if(vae($('#szdsel select'),"所在地")==false){return false;}
- if(vae($('#gksel select'),"港口")==false){return false;}
- if(vae($('#gqsel select'),"港区")==false){return false;}
- if(vae($('#zgqx'), "整改期限 ")==false){return false;}
- if(vae($('#jyrmc'),"被督查单位")==false){return false;}
-
-
- $(".btn").attr("disabled",true);
- $.ajax({
- url:$.app+"/jdjc/submit",
- data:$("#addform").serialize(),
- type:"post",
- dataType:"json",
- success:function(data){//ajax返回的数据
- if (data.success) {
- $.alert({
- title: '提示',
- content: '操作成功',
- confirm: function(){
- location.href=$.app+'/jdjc/main';
- }
- });
- }else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
- $(".btn").attr("disabled",false);
- }
- });
- }
- }
- });
- };
- jdjc.detail.audit=function(auditpass,id){
- $(".btn").attr("disabled",true);
-
- var audit;
- if(auditpass=="Y"){
- audit=true;
- }else{
- audit=false;
- }
- $('#flag').val(audit);
-
-
- $(".btn").attr("disabled",true);
- $.ajax({
- url:$.app + "/jdjc/audit",
- data:$("#addform").serialize(),
- type:"post",
- dataType:"json",
- success:function(data){//ajax返回的数据
- if (data.success) {
- $.alert({
- title: '提示',
- content: '操作成功',
- confirm: function(){
- jdjc.detail.back();
- }
- });
- }else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
- $(".btn").attr("disabled",false);
- }
- });
- }
- }
- });
-
- /*$.post($.app + "/jdjc/audit", {
- id:id,
- shyj:shyj,
- flag:audit,
- accid:accid
- }, function(data) {
- if (data.success) {
- $.alert({
- title: '提示',
- content: '操作成功',
- confirm: function(){
- jdjc.detail.back();
- }
- });
- }else {
- $.alert({
- title: '提示',
- content: data.message,
- confirm: function(){
- $(".btn").attr("disabled",false);
- }
- });
- }
-
- }, "json");*/
- };
- jdjc.detail.submitFile = function(){
- $('#addform').form('submit',{
- url : $.app + '/jdjc/saveFile',
- onSubmit : function() {},
- success : function(data, status) {
- if (data) {
- data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
- data = $.parseJSON(data);
- }
- if (data.success) {
- var len = $('#tableId tr').length;
- var accContect = data.attrs.acc.fjmc;
- var fjid = data.attrs.acc.fjid;
- var accid = data.attrs.acc.id;
- var str = "<tr align='center'>";
- str =str +"<td style='width:40%'>"+ "<input id='accid' value='"
- + accid
- + "' name='accid' type='hidden'>"
- + "<a class='main_title' href='/jsjy/accessory/download?id="
- + fjid + "'> " + accContect + "</a>" +"</td>";
-
- str =str+"<td style='width:15%'>"+ '<a class="btn btn-default btn-xs" href="#" onclick="jdjc.detail.delFj(\''
- + accid
- + '\','
- + '$(this)'
- + ')">删除</a>' +"</td></tr>";
- $('#tableId').append(str);
- } else {
- $.messager.showError(data.message);
- }
- }
- });
- }
- //删除accid 附件关联ID,id 是第几行附件
- jdjc.detail.delFj = function(accid, tr) {
- $.confirm({
- title : '确认框',
- content : '确认删除吗',
- confirm : function() {
- $.post($.app + "/jdjc/delFile", {
- accid : accid
- }, function(data) {
- if (data.success) {
- $(tr).parent().parent().remove();
- } else {
- $.alert({
- title : '提示',
- content : data.message,
- confirm : function() {
- }
- });
- }
- }, "json");
- },
- cancel : function() {
- }
- });
- }
|