jgbgdetail.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. $.namespace("jgbg.detail");
  2. jgbg.detail.szd =null;
  3. jgbg.detail.gk=null;
  4. jgbg.detail.gq=null;
  5. jgbg.detail.taskKey=null;
  6. jgbg.detail.opflag = null;
  7. jgbg.detail.init=function(){
  8. }
  9. jgbg.detail.back=function(){
  10. location.href=$.app+"/jgbg/main";
  11. }
  12. van=function(a,b){
  13. if(!isFDS(a.val())){
  14. ts(b+"必须为正数",a);
  15. return false;
  16. }
  17. };
  18. jgbg.detail.save=function(){
  19. //验证浮点类型
  20. if(van($('#addform input[name=ztz]'),"总投资")==false){return false;}
  21. if(van($('#addform input[name=axcd]'),"岸线长度 ")==false){return false;}
  22. if(van($('#addform input[name=bwdj]'),"泊位吨级 ")==false){return false;}
  23. if(van($('#addform input[name=tgnl]'),"通过能力")==false){return false;}
  24. $(".btn").attr("disabled",true);
  25. $.ajax({
  26. url:$.app+"/jgbg/save",
  27. data:$("#addform").serialize(),
  28. type:"post",
  29. dataType:"json",
  30. success:function(data){//ajax返回的数据
  31. if (data.success) {
  32. $.alert({
  33. title: '提示',
  34. content: '操作成功',
  35. confirm: function(){
  36. location.href=$.app+'/jgbg/main';
  37. }
  38. });
  39. }else {
  40. $.alert({
  41. title: '提示',
  42. content: data.message,
  43. confirm: function(){
  44. $(".btn").attr("disabled",false);
  45. }
  46. });
  47. }
  48. }
  49. });
  50. }
  51. jgbg.detail.submit=function(){
  52. //验证浮点类型
  53. if(van($('#addform input[name=ztz]'),"总投资")==false){return false;}
  54. if(van($('#addform input[name=axcd]'),"岸线长度 ")==false){return false;}
  55. if(van($('#addform input[name=bwdj]'),"泊位吨级 ")==false){return false;}
  56. if(van($('#addform input[name=tgnl]'),"通过能力")==false){return false;}
  57. $(".btn").attr("disabled",true);
  58. $.ajax({
  59. url:$.app+"/jgbg/submit",
  60. data:$("#addform").serialize(),
  61. type:"post",
  62. dataType:"json",
  63. success:function(data){//ajax返回的数据
  64. if (data.success) {
  65. $.alert({
  66. title: '提示',
  67. content: '操作成功',
  68. confirm: function(){
  69. location.href=$.app+'/jgbg/main';
  70. }
  71. });
  72. }else {
  73. $.alert({
  74. title: '提示',
  75. content: data.message,
  76. confirm: function(){
  77. $(".btn").attr("disabled",false);
  78. }
  79. });
  80. }
  81. }
  82. });
  83. }
  84. // 构建项目类型下拉
  85. function initXmlxSelect(divid,existVal,width){
  86. $.post($.app+"/jgbg/selectXmlx",{
  87. },function(data) {
  88. var str="";
  89. str+="<select class='xmlxselectpicker' name='xmlxid' id='xmlxid'>";
  90. str+="<option></option>";
  91. if(data){
  92. for(var i=0;i<data.length;i++){
  93. var xmlx=data[i];
  94. if(xmlx.val==existVal){
  95. str+=" <option selected='selected' value='"+xmlx.id+"' >"+xmlx.text+"</option>";
  96. }else{
  97. str+="<option value='"+xmlx.id+"'>"+xmlx.text+"</option>" ;
  98. }
  99. }
  100. }
  101. str+="</select>";
  102. $("#"+divid).empty;
  103. $("#"+divid).append(str);
  104. $('.xmlxselectpicker').selectpicker({
  105. width:width
  106. });
  107. }, "json");
  108. }
  109. // 构建投资类型下拉
  110. function initTzlxSelect(divid,existVal,width){
  111. $.post($.app+"/jgbg/selectTzlx",{
  112. },function(data) {
  113. var str="";
  114. str+="<select class='tzlxselectpicker' name='tzlxid' id='tzlxid'>";
  115. str+="<option></option>";
  116. if(data){
  117. for(var i=0;i<data.length;i++){
  118. var tzlx=data[i];
  119. if(tzlx.val==existVal){
  120. str+=" <option selected='selected' value='"+tzlx.id+"' >"+tzlx.text+"</option>";
  121. }else{
  122. str+="<option value='"+tzlx.id+"'>"+tzlx.text+"</option>" ;
  123. }
  124. }
  125. }
  126. str+="</select>";
  127. $("#"+divid).empty();
  128. $("#"+divid).append(str);
  129. $('.tzlxselectpicker').selectpicker({
  130. width:width
  131. });
  132. }, "json");
  133. }
  134. // 构建项目核准级别下拉
  135. function initXmhzjbSelect(divid,existVal,width){
  136. $.post($.app+"/jgbg/selectXmhzjb",{
  137. },function(data) {
  138. var str="";
  139. str+="<select class='xmhzjbselectpicker' name='xmhzjbid' id='xmhzjbid'>";
  140. str+="<option></option>";
  141. if(data){
  142. for(var i=0;i<data.length;i++){
  143. var xmhzjb=data[i];
  144. if(xmhzjb.val==existVal){
  145. str+=" <option selected='selected' value='"+xmhzjb.id+"' >"+xmhzjb.text+"</option>";
  146. }else{
  147. str+="<option value='"+xmhzjb.id+"'>"+xmhzjb.text+"</option>" ;
  148. }
  149. }
  150. }
  151. str+="</select>";
  152. $("#"+divid).empty();
  153. $("#"+divid).append(str);
  154. $('.xmhzjbselectpicker').selectpicker({
  155. width:width
  156. });
  157. }, "json");
  158. }
  159. // 构建岸线审批级别下拉
  160. function initAxspjbSelect(divid,existVal,width){
  161. $.post($.app+"/jgbg/selectAxspjb",{
  162. },function(data) {
  163. var str="";
  164. str+="<select class='axspjbselectpicker' name='axspjbid' id='axspjbid'>";
  165. str+="<option></option>";
  166. if(data){
  167. for(var i=0;i<data.length;i++){
  168. var axspjb=data[i];
  169. if(axspjb.val==existVal){
  170. str+=" <option selected='selected' value='"+axspjb.id+"' >"+axspjb.text+"</option>";
  171. }else{
  172. str+="<option value='"+axspjb.id+"'>"+axspjb.text+"</option>" ;
  173. }
  174. }
  175. }
  176. str+="</select>";
  177. $("#"+divid).empty();
  178. $("#"+divid).append(str);
  179. $('.axspjbselectpicker').selectpicker({
  180. width:width
  181. });
  182. }, "json");
  183. }
  184. jgbg.detail.initZyhbwfl=function(divid, existVal,bwytstr){
  185. var flag = "2";
  186. // var bwytstr = $('.bwytselectpicker').val()+"";
  187. if(bwytstr.indexOf("1804")>=0){
  188. flag="1";
  189. }
  190. $.post($.app + "/bw/selectZyhbwfl?flag="+flag, {
  191. }, function(data) {
  192. if (data) {
  193. var str = "";
  194. str+="<select class='zyhbwflselectpicker' name='zyhbwflid' id='zyhbwflid'>";
  195. str+="<option></option>";
  196. for(var i=0;i<data.length;i++){
  197. var zyhbwfl = data[i];
  198. if(zyhbwfl.id==existVal){
  199. str+=" <option selected='selected' value='"+zyhbwfl.id+"' >"+zyhbwfl.text+"</option>";
  200. }else{
  201. str+=" <option value='"+zyhbwfl.id+"' >"+zyhbwfl.text+"</option>";
  202. }
  203. }
  204. str+="</select>";
  205. $("#"+divid).empty();
  206. $("#"+divid).append(str);
  207. $('.zyhbwflselectpicker').selectpicker({
  208. width:'80%'
  209. });
  210. } else {
  211. }
  212. }, "json");
  213. };
  214. jgbg.detail.initBwyt=function(divid, existVal){
  215. $.post($.app + "/bw/selectBwyt", {
  216. }, function(data) {
  217. if (data) {
  218. var existValArr = existVal.split(",");
  219. var str = "";
  220. str+="<select multiple='multiple' onchange='ytsel()' class='bwytselectpicker' name='bwyt' id='bwyt' >";
  221. str+="<option></option>";
  222. for(var i=0;i<data.length;i++){
  223. var flag = false;
  224. var bwyt = data[i];
  225. for(var j = 0; j < existValArr.length; j++){
  226. if(bwyt.id==existValArr[j]){
  227. flag = true;
  228. str+=" <option selected='selected' value='"+bwyt.id+"' >"+bwyt.text+"</option>";
  229. break;
  230. } else {
  231. flag = false;
  232. }
  233. }
  234. if(!flag){
  235. str+=" <option value='"+bwyt.id+"' >"+bwyt.text+"</option>";
  236. }
  237. }
  238. str+="</select>";
  239. $("#"+divid).empty();
  240. $("#"+divid).append(str);
  241. $('.bwytselectpicker').selectpicker({
  242. width: '80%'
  243. });
  244. } else {
  245. }
  246. }, "json");
  247. };
  248. //构建所在地的下拉
  249. //参数说明依次,1(必须)存放下拉的div的id,2(非必须)下拉初始选中的值,没有传没有传空字符串,3(非必须)下拉change事件,根据需要添加4(必须)下拉框的长度
  250. //此下拉如果跟着form一起提交后台的话,对应的是szd属性,
  251. jgbg.detail.initszdSelect=function(divid,existVal,changefunc,width,disable){
  252. $.post($.app + "/selectSzd", {
  253. }, function(data) {
  254. var str = "";
  255. if(changefunc!=null&&changefunc!=""){
  256. if(disable!=null&&disable!=''){
  257. str+="<select disabled class='szdselectpicker' name='szdid' onchange='"+changefunc+"()' id='szdid'>";
  258. }else{
  259. str+="<select class='szdselectpicker' name='szdid' onchange='"+changefunc+"()' id='szdid'>";
  260. }
  261. }else{
  262. if(disable!=null&&disable!=''){
  263. str+="<select disabled class='szdselectpicker' name='szdid' id='szdid'>";
  264. }else{
  265. str+="<select class='szdselectpicker' name='szdid' id='szdid'>";
  266. }
  267. }
  268. str+="<option></option>";
  269. if(data){
  270. for(var i=0;i<data.length;i++){
  271. var szd = data[i];
  272. if(szd.val==existVal){
  273. str+=" <option selected='selected' value='"+szd.id+"' >"+szd.text+"</option>";
  274. }else{
  275. str+=" <option value='"+szd.id+"' >"+szd.text+"</option>";
  276. }
  277. }
  278. }
  279. str+="</select>";
  280. $("#"+divid).empty();
  281. $("#"+divid).append(str);
  282. $('.szdselectpicker').selectpicker({
  283. width:width
  284. });
  285. }, "json");
  286. }
  287. //构建港口的下拉
  288. //参数说明依次,1(必须)存放下拉的div的id,2(非必须)下拉初始选中的值,没有传空字符串,3(非必须)参数,根据所在地过滤结果,一般级联需要4(非必须)下拉change事件5(必须)下拉框的长度
  289. //此下拉如果跟着form一起提交后台的话,对应的是szd属性,
  290. jgbg.detail.initgkSelect=function(divid,existVal,szd,changefunc,width,disable){
  291. $.post($.app + "/selectGk", {
  292. szd:szd
  293. }, function(data) {
  294. var str = "";
  295. if(changefunc!=null&&changefunc!=""){
  296. if(disable!=null&&disable!=''){
  297. str+="<select disabled class='gkselectpicker' name='szgkid' onchange='"+changefunc+"()' id='szgkid'>";
  298. }else{
  299. str+="<select class='gkselectpicker' name='szgkid' onchange='"+changefunc+"()' id='szgkid'>";
  300. }
  301. }else{
  302. if(disable!=null&&disable!=''){
  303. str+="<select disabled class='gkselectpicker' name='szgkid' id='szgkid'>";
  304. }else{
  305. str+="<select class='gkselectpicker' name='szgkid' id='szgkid'>";
  306. }
  307. }
  308. str+="<option></option>";
  309. if(data){
  310. for(var i=0;i<data.length;i++){
  311. var gk = data[i];
  312. if(gk.id==existVal){
  313. str+=" <option selected='selected' value='"+gk.id+"' >"+gk.gkmc+"</option>";
  314. }else{
  315. str+=" <option value='"+gk.id+"' >"+gk.gkmc+"</option>";
  316. }
  317. }
  318. }
  319. str+="</select>";
  320. $("#"+divid).empty();
  321. $("#"+divid).append(str);
  322. $('.gkselectpicker').selectpicker({
  323. width:width
  324. });
  325. //如果所在地选择为空,重置港区select;
  326. }, "json");
  327. }
  328. //构建港区的下拉
  329. //参数说明依次,1(必须)存放下拉的div的id,2(非必须)下拉初始选中的值,没有传空字符串,3(非必须)参数,根据所在地过滤结果,一般级联需要4(非必须)下拉change事件5(必须)下拉框的长度
  330. //此下拉如果跟着form一起提交后台的话,对应的是szd属性,
  331. jgbg.detail.initgqSelect=function(divid,existVal,szd,gk,changefunc,width,disable){
  332. $.post($.app + "/selectGq", {
  333. szd:szd,
  334. szgk:gk
  335. }, function(data) {
  336. var str = "";
  337. if(changefunc!=null&&changefunc!=""){
  338. if(disable!=null&&disable!=''){
  339. str+="<select disabled class='gqselectpicker' name='szgqid' onchange='"+changefunc+"()' id='szgqid'>";
  340. }else{
  341. str+="<select class='gqselectpicker' name='szgqid' onchange='"+changefunc+"()' id='szgqid'>";
  342. }
  343. }else{
  344. if(disable!=null&&disable!=''){
  345. str+="<select disabled class='gqselectpicker' name='szgqid' id='szgqid'>";
  346. }else{
  347. str+="<select class='gqselectpicker' name='szgqid' id='szgqid'>";
  348. }
  349. }
  350. str+="<option></option>";
  351. if(data){
  352. for(var i=0;i<data.length;i++){
  353. var gq = data[i];
  354. if(gq.id==existVal){
  355. str+=" <option selected='selected' value='"+gq.id+"' >"+gq.gqmc+"</option>";
  356. }else{
  357. str+=" <option value='"+gq.id+"' >"+gq.gqmc+"</option>";
  358. }
  359. }
  360. }
  361. str+="</select>";
  362. $("#"+divid).empty();
  363. $("#"+divid).append(str);
  364. $('.gqselectpicker').selectpicker({
  365. width:width
  366. });
  367. }, "json");
  368. }
  369. jgbg.detail.audit=function(auditpass,id){
  370. if(auditpass=="Y" && (jgbg.detail.opflag == 5 || jgbg.detail.opflag == 9)){
  371. if(isEmpty($('#userids').val())){
  372. $.alert({
  373. title: '提示',
  374. content: "请选择人员会签!!!",
  375. confirm: function(){
  376. $(".btn").attr("disabled",false);
  377. }
  378. });
  379. return false;
  380. }
  381. }
  382. //附件
  383. var accidName= document.getElementsByName("accid");
  384. var accids = [];
  385. for (i=0; i<accidName.length; i++){
  386. accids.push(accidName[i].value)
  387. }
  388. $('#accids').val(accids);
  389. $(".btn").attr("disabled",true);
  390. var opflag = $('#opflag').val();
  391. var shyj = $('#yj').val();
  392. var audit;
  393. if(auditpass=="Y"){
  394. audit=true;
  395. }else{
  396. audit=false;
  397. }
  398. $.post($.app + "/jgbg/audit", {
  399. id:id,
  400. shyj:shyj,
  401. flag:audit,
  402. userids:$('#userids').val(),
  403. accid:$('#accids').val()
  404. }, function(data) {
  405. if (data.success) {
  406. $.alert({
  407. title: '提示',
  408. content: '操作成功',
  409. confirm: function(){
  410. jgbg.detail.back();
  411. }
  412. });
  413. }else {
  414. $.alert({
  415. title: '提示',
  416. content: data.message,
  417. confirm: function(){
  418. $(".btn").attr("disabled",false);
  419. }
  420. });
  421. }
  422. }, "json");
  423. };
  424. jgbg.detail.submitFile = function(){
  425. $('#addform').form('submit',{
  426. url : $.app + '/jgbg/saveFile',
  427. onSubmit : function() {},
  428. success : function(data, status) {
  429. if (data) {
  430. data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
  431. data = $.parseJSON(data);
  432. }
  433. if (data.success) {
  434. var len = $('#tableId tr').length;
  435. var accContect = data.attrs.acc.fjmc;
  436. var fjid = data.attrs.acc.fjid;
  437. var accid = data.attrs.acc.id;
  438. var str = "<tr align='center'>";
  439. str =str +"<td style='width:40%'>"+ "<input id='accid' value='"
  440. + accid
  441. + "' name='accid' type='hidden'>"
  442. + "<a class='main_title' href='/jsjy/accessory/download?id="
  443. + fjid + "'> " + accContect + "</a>" +"</td>";
  444. str =str+"<td style='width:15%'>"+ '<a class="btn btn-default btn-xs" href="#" onclick="jgbg.detail.delFj(\''
  445. + accid
  446. + '\','
  447. + '$(this)'
  448. + ')">删除</a>' +"</td></tr>";
  449. $('#tableId').append(str);
  450. } else {
  451. $.messager.showError(data.message);
  452. }
  453. }
  454. });
  455. }
  456. //删除accid 附件关联ID,id 是第几行附件
  457. jgbg.detail.delFj = function(accid, tr) {
  458. $.confirm({
  459. title : '确认框',
  460. content : '确认删除吗',
  461. confirm : function() {
  462. $.post($.app + "/jgbg/delFile", {
  463. accid : accid
  464. }, function(data) {
  465. if (data.success) {
  466. $(tr).parent().parent().remove();
  467. } else {
  468. $.alert({
  469. title : '提示',
  470. content : data.message,
  471. confirm : function() {
  472. }
  473. });
  474. }
  475. }, "json");
  476. },
  477. cancel : function() {
  478. }
  479. });
  480. }
  481. jgbg.detail.submitAudit=function(){
  482. $(".btn").attr("disabled",true);
  483. $.ajax({
  484. url:$.app+"/jgbg/submitAudit",
  485. data:$("#addform").serialize(),
  486. type:"post",
  487. dataType:"json",
  488. success:function(data){//ajax返回的数据
  489. if (data.success) {
  490. $.alert({
  491. title: '提示',
  492. content: '操作成功',
  493. confirm: function(){
  494. location.href=$.app+'/jgbg/main';
  495. }
  496. });
  497. }else {
  498. $.alert({
  499. title: '提示',
  500. content: data.message,
  501. confirm: function(){
  502. $(".btn").attr("disabled",false);
  503. }
  504. });
  505. }
  506. }
  507. });
  508. }