mailList.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <div id="mailList" class="plg-tab-container">
  2. <div id="mail" class="grid-container-full"></div>
  3. </div>
  4. <div id="mailList_mywin" style="display: none;height: 550px;">
  5. <div id="mailList_g1"></div>
  6. </div>
  7. <style type="text/css">
  8. .layui-form-label{width:210px;}
  9. .layui-input{width:66%;}
  10. .plg-btn-height-auto, .plg-btn-normal, .plg-btn-normal:hover {
  11. height: auto!important;
  12. }
  13. .plg-btn-normal, .plg-btn-normal:hover {
  14. border-radius: 4px;
  15. box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
  16. color: rgba(0, 0, 0, 0.65);
  17. background-color: #fff;
  18. border-color: #d9d9d9;
  19. }
  20. .plg-btn-normal {
  21. border: 1px solid rgb(217, 217, 217)!important;
  22. }
  23. .plg-btn-normal:hover {
  24. border: 1px solid #3da0e3!important;
  25. }
  26. </style>
  27. <script type="text/javascript">
  28. (function(){
  29. var form=$("#mailList #form1");
  30. var opts = {
  31. skin:"terrace",
  32. columns:[
  33. {id:"id",name:"id",type:'txt',width:100,hidden:true},
  34. {id:"toAddress",name:"收件人邮箱",type:'ro',width:150},
  35. {id:"subject",name:"邮件标题",type:'ro',width:200},
  36. {id:"content",name:"邮件内容",type:'ro',width:"*"},
  37. {id:"attachment",name:"附件",type:'ro',width:150, hidden:true},
  38. {id:"fromName",name:"发件人名称",type:'ro',width:120},
  39. {id:"createTime",name:"创建时间",type:'ro',width:200},
  40. {id:"host",name:"邮件服务器",type:'ro',width:150, hidden:true},
  41. {id:"fromAddress",name:"发件人邮箱",type:'ro',width:150,hidden:true}
  42. // {id:"systemId",name:"系统id",type:'ro',width:150,hidden:true}
  43. ],
  44. toolbar:[
  45. {type:"combo", name:"systemId", label:"系统id:", width:140},{type: "newcolumn"},
  46. {type:"button", name:"addBtn", className:"plg-toolbar-right",value:"<i class='layui-icon layui-icon-add-1'></i>写邮件"},{type: "newcolumn"},
  47. {type:"input", name:"toAddress", label:"收件人邮箱:",offsetLeft:10, placeholder: '请输入收件人邮箱'},{type: "newcolumn"},
  48. {type:"input", name:"content", label:"邮件内容:",offsetLeft:10, placeholder: '请输入邮件内容'},{type: "newcolumn"},
  49. {type:"button", name:"searchBtn", className:"", value:"查询"},{type: "newcolumn"},
  50. {type:"button", name:"all", className:"normal", value:"所有"}
  51. ],
  52. formData:[
  53. {type:"settings",inputWidth :300,width:400,labelWidth:80,position:"label-left",labelAlign:"left"},
  54. {type: "hidden", name:"id", value:""},
  55. {type: "input", name: "toAddress", label: "收件人邮箱:", validate: 'NotEmpty', required: true, placeholder: '多收件人请用";"分隔'},
  56. {type: "input", name:"subject", label:"邮件标题:", validate: 'NotEmpty', required: true, placeholder: '请输入邮件标题'},
  57. {type: "input", name:"fromName", label:"发件人名称:"},
  58. {type: "combo", name: "systemId", width:300, label: "系统id:", remote:{url:'/api/service-users/sys/getSelectSystem/v1.0',data:{},valueField:"val",textField:"val",method:"get"}},
  59. {type: "input", name:"content", label:"邮件内容:", validate: 'NotEmpty', required: true, placeholder: '请输入邮件内容',rows: 5}
  60. ],
  61. pagebar:{
  62. buttons:[
  63. {text:"<i class='layui-icon layui-icon-delete '></i>删除",className:"layui-btn-danger plg-btn-height-auto",name:"delete"}
  64. ]
  65. },
  66. url:"/api/service-mail/mail",//数据接口
  67. type:"get",//数据提交方式,默认为get
  68. params:{pageNum:1,pageSize:10},//查询提交参数,分页参数默认为pageNum,pageSize
  69. page:true, //是否启用分页
  70. multiselect:true,//是否支持多选
  71. imagePath:"../../prologui/assets/PlgGrid/",
  72. totalCount:"totalCount" //总记录数字段,默认totalCount
  73.    };
  74. var mail = new PlgGrid(opts);
  75. mail.renderTo("mail");
  76. mail.loadData();
  77. mail.attachToolBarEvent("onButtonClick", function(name,ids){
  78. if(name=="searchBtn"){
  79. var fdata = mail.getToolBarForm().getFormData();
  80. mail.setParams(fdata);
  81. mail.reload();
  82. }else if(name=="all"){
  83. mail.setParams({pageNum:1,pageSize:10,systemId:"",name:""});
  84. mail.reload();
  85. }else if(name=="addBtn"){
  86. mailList_add();
  87. }
  88. });
  89. mail.attachPageBarEvent(function(name,ids){
  90. if(name=="delete"){
  91. if(ids==""){
  92. return;
  93. }
  94. PlgDialog.confirm('确定删除?', {
  95. title:'删除提示',
  96. btnAlign:'c',
  97. btn: ['确定', '取消'] //可以无限个按钮
  98. }, function(index, layero){
  99. $.ajax({
  100. url: '/api/service-mail/mail/del',
  101. type: 'post',
  102. data:{id:ids},
  103. success:function (data) {
  104. PlgDialog.close(index);
  105. mail.reload();
  106. PlgDialog.msg(data.message);
  107. }
  108. });
  109. });
  110. }
  111. });
  112. function mailList_add(){
  113. mail.showDialog(0,"写邮件",450,400,{url:"/api/service-mail/mail/sendMail",type:"post",contentType:"application/x-www-form-urlencoded"});
  114. var g = mail.getGridForm();
  115. g.loadComboData("systemId",{url:'/api/service-users/sys/getSelectSystem/v1.0',data:{},valueField:"val",textField:"val",method:"get"});
  116. }
  117. // mail.on("onRowDblClicked",function(){
  118. // mail.showDialog(1,"编辑",450,300,{url:"/api/service-quartz/mail",type:"put",contentType:"application/json"});
  119. // });
  120. var f = mail.getToolBarForm();
  121. f.loadComboData("systemId",{url:'/api/service-users/sys/getSelectSystem/v1.0',data:{},valueField:"val",textField:"val",method:"get"});
  122. })()
  123. </script>