a2515c7ae1d6662c2e1dab4212d4d2524edd65f4.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. var userId=top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  2. var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  3. var comp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  4. var loadparams = {
  5. "listId" : '778',
  6. "condition" : " MSG_MODEL_USER='"+userId+"' and is_del='0' and msg_model_dept ='"+dept_name+"' and msg_model_comp='"+comp_name+"'",
  7. direction : 'desc', // 排序方式
  8. sort : 'MSG_MODEL_TIME'
  9. };
  10. var g;
  11. var option;
  12. var options;
  13. //初始化列表
  14. function initComplete(){
  15. option = {
  16. columns: [
  17. {display : '范本类型',name : 'MSG_MODEL_TYPE_778_SHOW', align : 'center',width : '10%',showTitle:true},
  18. {display : '范本主题',name : 'MSG_MODEL_TITLE_778', align : 'center',width : '10%',showTitle:true},
  19. {display : '范本内容',name : 'MSG_MODEL_CONTENT_778', align : 'center',width : '22%',showTitle:true},
  20. {display : '应用范围',name : 'MSG_MODEL_RANGE_778_SHOW', align : 'center',width : '10%',showTitle:true},
  21. {display : '创建部门',name : 'MSG_MODEL_DEPT_778', align : 'center',width : '10%',showTitle:true},
  22. {display : '创建单位',name : 'MSG_MODEL_COMP_778', align : 'center',width : '13%',showTitle:true},
  23. {display : '创建人员',name : 'REAL_NAME_778', align : 'center',width : '10%',showTitle:true},
  24. {display : '创建时间',name : 'MSG_MODEL_TIME_778', align : 'center',width : '15%',showTitle:true}
  25. ],
  26. rownumbers : true,
  27. checkbox : true,
  28. pageSize : 5,
  29. percentWidthMode : true
  30. };
  31. //var roleCons = roleButtonArr();
  32. var toolBars = {
  33. items: [
  34. { text: '新增', click: 'onAdd', iconClass: 'add1_tem', disabled: false,id:"10501" },
  35. { text: '删除', click: 'onDelete', iconClass: 'delete_tem', disabled: false ,id:"10502" },
  36. { text: '修改', click: 'onEdit', iconClass: 'update_tem', disabled: false ,id:"10503" }
  37. ]
  38. // roleCons:roleCons
  39. };
  40. options={
  41. url :$.pathname() + '/ws/crud/CRUDService/queryQui',
  42. params:loadparams,
  43. width:"100%",
  44. gridOptions:option,
  45. paperOpration:{showInput:"true"},
  46. toolBarOptions:toolBars
  47. };
  48. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options);
  49. }
  50. //查询
  51. function searchHandler(){
  52. var MSG_MODEL_TITLE = $('#MSG_MODEL_TITLE_919').val().trim();
  53. var condition=" MSG_MODEL_USER='"+userId+"' and is_del='0' and msg_model_dept ='"+dept_name+"' and msg_model_comp='"+comp_name+"'";
  54. if(MSG_MODEL_TITLE!=""&&MSG_MODEL_TITLE!="请输入范本主题"){
  55. condition+="AND MSG_MODEL_TITLE LIKE '%"+MSG_MODEL_TITLE+"%'";
  56. }
  57. var searchCondition = getSelectCon(conditionData);
  58. g.setOptions({//重置加载列表的参数
  59. params : {
  60. "listId" :'778' ,
  61. "condition" : searchCondition.condition+condition,
  62. direction : 'desc', // 排序方式
  63. sort : 'MSG_MODEL_TIME'
  64. }
  65. });
  66. g.rend();
  67. var text = $(".l-grid-body2").text();
  68. if(text==""){
  69. $(".l-grid-body2 table").css("width","100%");
  70. $(".l-grid-body2 tbody").append($('<tr style="text-align:center;"><td colspan="6"><div style="height:50px;line-height:50px;font-size:14px;">此列表暂无数据!</div></td></tr>'));
  71. }
  72. }
  73. //查询表单验证
  74. function findMsg() {
  75. var valid = $("#searchQueryForm").validationEngine({
  76. returnIsValid : true,
  77. });
  78. if(valid==true){
  79. searchHandler();
  80. }else{
  81. top.Dialog.alert("搜索框内容输入不正确,请检查");
  82. }
  83. }
  84. //修改
  85. function onEdit(){
  86. var rows = g.getSelectedRows();
  87. if(rows.length==0){
  88. top.Dialog.alert("请选择一条记录");
  89. return;
  90. }
  91. if(rows.length>1){
  92. top.Dialog.alert("只能选择一条记录");
  93. return;
  94. }
  95. if(userId!=rows[0].MSG_MODEL_USER_778){
  96. top.Dialog.alert("不可修改其他人填写的模版");
  97. return;
  98. }
  99. var comp = rows[0].MSG_MODEL_COMP_778;
  100. var fd_id = rows[0].FD_OBJECTID_778;
  101. var type = rows[0].MSG_MODEL_TYPE_778;
  102. var title = rows[0].MSG_MODEL_TITLE_778;
  103. var content = rows[0].MSG_MODEL_CONTENT_778;
  104. $("#content").val(content);
  105. var range = rows[0].MSG_MODEL_RANGE_778;
  106. var dept = rows[0].MSG_MODEL_DEPT_778;
  107. var people = rows[0].REAL_NAME_778;
  108. var diag = new top.Dialog();
  109. diag.Title = "修改范本";
  110. diag.URL = encodeURI($.pathname() + '/page/system/sms/msg_model_update1.html?'+fd_id+"?"+type+"?"+title+"?"+range+"?"+dept+"?"+people+"?"+comp+"?"+content);
  111. diag.Width = 900;
  112. diag.Height = 320;
  113. /* diag.Top = "80%";*/
  114. diag.Left = "50%";
  115. diag.ID = "addFanBen";
  116. /* diag.Top = "80%";*/
  117. diag.Left = "50%";
  118. diag.ShowOkButton=false;// 不显示确认按钮
  119. diag.ButtonAlign = 'center';
  120. diag.show();
  121. diag.addButton("edit","修改",function(){
  122. diag.innerFrame.contentWindow. save();
  123. shuaxin();
  124. g.rend();
  125. });
  126. }
  127. //新增
  128. function onAdd(){
  129. var diag = new top.Dialog();
  130. diag.Title = "新增范本";
  131. diag.URL = $.pathname() + '/page/system/sms/msg_model_update1.html';
  132. diag.Width = 900;
  133. diag.Height = 320;
  134. /* diag.Top = "80%";*/
  135. diag.Left = "50%";
  136. diag.ID = "addFanBen";
  137. diag.ShowOkButton=false;
  138. diag.ButtonAlign = 'center';
  139. diag.show();
  140. diag.addButton("add","新增",function(){
  141. diag.innerFrame.contentWindow. save();
  142. shuaxin();
  143. g.rend();
  144. });
  145. }
  146. function shuaxin(){
  147. g.rend();
  148. }
  149. //删除
  150. function onDelete(){
  151. var rows = g.getSelectedRows();
  152. var rowsLength = rows.length;
  153. if (rowsLength == 0) {
  154. top.Dialog.alert("请选中要删除的记录!");
  155. return;
  156. }
  157. var ids = "";
  158. //var user_id="";
  159. //alert(rows[0].FD_OBJECTID_778);
  160. for ( var i = 0; i < rowsLength; i++) {
  161. if(userId!=rows[i].MSG_MODEL_USER_778){
  162. top.Dialog.alert("不可删除其他人的模版记录");
  163. return;
  164. }else{
  165. ids += rows[i].FD_OBJECTID_778 + ";";
  166. }
  167. }
  168. top.Dialog.confirm("确定要删除吗?|删除", function() {
  169. // 删除记录
  170. $.post($.pathname() +"/ws/sendsms/SendSmsService/delMsg/", {
  171. fd_id : ids,
  172. stat:"MODEL"
  173. }, function(result) {
  174. if (result.Msg.sucsess == true) {
  175. $.messager.alert("删除成功",null,null,null,1);
  176. // 刷新表格数据
  177. g.rend();
  178. } else {
  179. top.Dialog.alert("删除失败!");
  180. }
  181. }, "json");
  182. });
  183. }
  184. $.messager=top.Dialog;
  185. //刷新表格 表单提交的回调
  186. function afterFormSubmit(){
  187. g.rend();
  188. }
  189. ///返回短信管理
  190. function goback(){
  191. window.parent.document.getElementById("frmright").setAttribute("src", "/nwyj/page/system/sms/msg_manage.html");
  192. }
  193. window.onload = function (){
  194. $(".selectbox").attr("readonly","readonly");
  195. };
  196. //查询
  197. function check(event){
  198. if(event.keyCode==13){
  199. findMsg();
  200. }
  201. }
  202. $("#searchButt").live("click",function(){
  203. findMsg();
  204. });