9e195b59e59078b4a52b5b4249b72ff05672b5d3.svn-base 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /**
  2. * 功能:应急预警报告添加及修改
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/12/9
  7. */
  8. TeamDemandInfo = function() {
  9. /**定义变量**/
  10. var _this = this;
  11. _this.listGrid = null;// 预警数据列表
  12. var flag=false;
  13. var isNew=false; //是否是新增记录
  14. var editingRow; // 双击的当前编辑行
  15. var index = 0;
  16. /**新增方法**/
  17. _this.save = function(diag,fd_id){
  18. /********** 弹框start **********/
  19. var valid = diag.innerFrame.contentWindow.$("#ideaForm").validationEngine({returnIsValid: true});//弹框页面的非空验证
  20. if(!valid){
  21. top.Dialog.alert("请检查红色输入框!");
  22. return;
  23. };
  24. // var a = diag.innerFrame.contentWindow.$("#EXPLAIN_37800").val();//弹框页面的回退说明的值
  25. // $("#EXPLAIN_378").val(a);//给主页面的回退说明标签赋值
  26. var b = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").val();//弹框页面的下一节点人的id
  27. $("#PERSON_ID_378").val(b);//给主页面的下一节点人id赋值
  28. //alert(b);
  29. if(b=='' && b == undefined){
  30. top.Dialog.alert("请选择下一处理人!");
  31. return;
  32. }
  33. var c = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().html();//弹框页面的下一节点人的NAME
  34. $("#PERSON_NAME_378").val(c);//给主页面的下一节点人NAME赋值
  35. var d = diag.innerFrame.contentWindow.$("#temp input[name='PERSON_ID_378']:checked").next().next().val();//弹框页面的下一节点人的电话
  36. var e = diag.innerFrame.contentWindow.$("#msgRemind").attr("checked");//短信是否被勾选
  37. var f = diag.innerFrame.contentWindow.$("#appRemind").attr("checked");//app是否被勾选
  38. var isPass = diag.innerFrame.contentWindow.$(".aa[checked='checked']").val();//判断是否同意
  39. var g = '有新报审的队伍需求,请您及时处理!';//短信内容
  40. var h = getDateTime();//系统时间
  41. if(e=='checked'){//短信被勾选
  42. //alert("短信提醒");
  43. if(b == undefined){
  44. top.Dialog.alert("请选择短信接收人!");
  45. return;
  46. }
  47. var url0 = $.pathname() + '/ws/sendsms/SendSmsService/saveMessage';
  48. var params = {
  49. realName : realName,//发送人真实姓名
  50. smsRecTel : d,//接收电话
  51. smsTime : h,//系统时间
  52. smsContent : g,//短信内容
  53. smsSendId : realName_ID,//发送人Id
  54. smsPeople : b,//接收人员id?还是name?
  55. type:"短信发送"
  56. };
  57. $.ajax({
  58. type : 'post',
  59. url : url0,
  60. data : params,
  61. async:false,
  62. dataType : 'json',
  63. success : function (data){
  64. //alert(JSON.stringify(data));
  65. //addMsg(data.list.split("|")[0],data.list.split("|")[1],"新报审了一个队伍需求,请及时审核!");
  66. },
  67. error : function(e){
  68. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  69. }
  70. });
  71. }
  72. if(f=='checked'){
  73. alert("应急app提醒!");
  74. }
  75. diag.innerFrame.contentWindow.top.Dialog.close();//关闭弹框
  76. /********** 弹框end **********/
  77. $form = $('#editForm1');
  78. var valid = $form.validationEngine({returnIsValid: true});
  79. if(valid){
  80. var params = {
  81. classid : "391",
  82. FD_OBJECTID391 : $("#FD_OBJECTID391").val(),
  83. STATE_391 : "132"
  84. };
  85. $.ajax({
  86. url : $.pathname() + '/ws/crud/CRUDService/update/',
  87. type : 'post',
  88. timeout : 15000,
  89. data : params,
  90. dataType : 'json',
  91. success : function(data) {
  92. // $("#PERSON_NAME_378").val($("#PERSON_ID_378").attr("relText"));
  93. $("#PERSON_NAME_378").val($("#PERSON_NAME_378").val());
  94. var url = $.pathname() + '/ws/crud/CRUDService/create/';
  95. var formValue = $form.serialize();
  96. $.request.add(url,formValue,function(data){
  97. closeProgress();
  98. /*top.Dialog.confirm("报审成功!是否发送短信通知?", function() {
  99. $.ajax({
  100. url : $.pathname()+ '/ws/qrps/QueryReportProgrammeService/reportPlanSendMsg',
  101. type : 'post',
  102. data : {
  103. 'fd_id' : fd_id,
  104. 'userId':userId,
  105. 'comp_id':deptId
  106. },
  107. async:false,
  108. dataType : 'json',
  109. success : function(data) {
  110. addMsg(data.list.split("|")[0],data.list.split("|")[1],"新报审了一个队伍需求,请及时审核!");
  111. },
  112. error : function(e) {
  113. $.messager.alert('访问服务失败!', 'error');
  114. }
  115. });
  116. });*/
  117. top.Dialog.alert('报审成功!', null, null, null, -1);
  118. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  119. });
  120. },
  121. error : function(e) {
  122. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  123. }
  124. });
  125. }else{
  126. top.Dialog.alert('请选择下一节点处理人', null, null, null, -1);
  127. }
  128. };
  129. return {
  130. init : function() {
  131. var temp = {"pager.pageNo":0,"pager.totalRows":0,"rows":[]};
  132. /** grid载入数据* */
  133. _this.listGrid = $("#maingrid").quiGrid( {
  134. //title : "预警接收管理数据列表",
  135. columns : [
  136. { display: '队伍类型', name: 'ANSWER_CODE_331', align: 'center', width: "35%",editor: { type: 'text' }},
  137. { display: '需求人数', name: 'THIS_ANSWER_GRADE_331', align: 'center', width: "35%",editor: { type: 'text' }}
  138. ],
  139. //url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  140. data:temp,
  141. height : "200",
  142. width : "100%",
  143. rownumbers:true,
  144. percentWidthMode : true,
  145. usePager:false,
  146. enabledEdit: true,
  147. clickToEdit: false,
  148. onDblClickRow:function(rowdata, rowindex){
  149. _this.listGrid.endEdit(editingRow);
  150. _this.listGrid.beginEdit(rowindex);
  151. editingRow = rowindex;
  152. }
  153. });
  154. var fd_id = (window.location.href).split('?')[1];//获取记录id
  155. var ids = fd_id.split("=");
  156. $.post($.pathname() + '/ws/crud/CRUDService/getDataById/',{classid : '391',objectID : ids[1]},function(data){
  157. var test = {"pager.pageNo":1,"pager.totalRows":3,"rows":JSON.parse(data.TROOPS_391)};
  158. _this.listGrid.loadData(test);
  159. });
  160. /********** 弹框start **********/
  161. $("#pass00").bind("click",function(){
  162. var isPass=2;//报审
  163. dialogDemo(isPass);
  164. });
  165. function dialogDemo(isPass){
  166. var fdid = (window.location.href).split('=')[1];//获取记录id(1)
  167. var fd_id = fdid.split('&')[0];//获取记录id(2)
  168. // alert(fd_id)
  169. //var ifmHeight = $(top.document.body).find("#frmright").height();
  170. var diag = new top.Dialog();
  171. diag.Title = '报审';
  172. diag.URL = $.pathname() + '/page/business/em/response/team/TeamNextRole.jsp?fd_id='+fd_id+'&isPass=2&deptId='+deptId; //修改对应的路径的编辑界面
  173. diag.OkButtonText = '提交';
  174. diag.OKEvent = function(){
  175. _this.save(diag,fd_id);
  176. };
  177. diag.Width = 500; //宽度
  178. diag.Height = 240; //高度
  179. diag.ButtonAlign = 'center';
  180. diag.show();
  181. };
  182. /********** 弹框end **********/
  183. $('#save').bind('click',function(){
  184. _this.save();
  185. });
  186. /*$('#close').bind('click',function(){
  187. alert("123");
  188. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  189. });*/
  190. $('#back').bind('click',function(){
  191. $('#frmright',window.parent.document).attr('src',$.pathname()+'/page/business/em/response/team/demandManage.jsp?pagenumber=');
  192. });
  193. }
  194. };
  195. }();
  196. $(function() {
  197. TeamDemandInfo.init();
  198. });