project_contact.html 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <div class="p-3 bg-white">
  2. <table class="layui-hide" id="contact" lay-filter="contact"></table>
  3. </div>
  4. <script>
  5. function contact() {
  6. if ($('#projectTab').find('li').eq(2).data('load') == 'true') {
  7. return false;
  8. }
  9. $('#projectTab').find('li').eq(2).data('load', 'true');
  10. let tool = layui.tool, table = layui.table;
  11. //项目任务
  12. parent.layui.contactTable = table.render({
  13. elem: '#contact',
  14. title: '文档列表',
  15. toolbar: '#toolbarcontact',
  16. cellMinWidth: 80,
  17. url: "/admin/project.contact/conlist_proprietor",
  18. where: {'project_id': project_id},
  19. page: true, //开启分页
  20. limit: 20,
  21. cols: [[
  22. {field: 'id', title: '序号', width: 80, align: 'center'},
  23. {field: 'title', title: '联系函名称',align: 'center',
  24. templet: function (d) {
  25. var html = "";
  26. if(d.audit_status == 0 || d.audit_status == 2){
  27. html = '<a class="side-a" lay-event="detail" lay-event="detail">' + d.title + '</a>';
  28. }else{
  29. html = '<a class="side-a" lay-event="detail" style="color: grey;text-decoration:line-through" lay-event="detail">' + d.title + '</a>';
  30. }
  31. return '<div style="text-align:left">' + html + '</div>'
  32. }
  33. },
  34. {field: 'create_time', title: '创建时间', align: 'center', width: 150},
  35. {field: 'admin_name', title: '创建人', align: 'center', width: 100},
  36. {field: 'approver', title: '审批人', align: 'center', width: 100},
  37. {field: 'right', fixed: 'right', title: '操作', width: 100, align: 'center',
  38. templet: function (d) {
  39. var html = '<div class="layui-btn-group">';
  40. var btn1 = `<a class="layui-btn layui-btn-xs layui-bg-blue" lay-event="detail">查看</a>`;
  41. var btn3 = `<a class="layui-btn layui-btn-xs" href=${d.filepath} download=${d.name} lay-event="">下载</a>`;
  42. return html + btn1 + btn3 + '</div>';
  43. }
  44. }
  45. ]]
  46. });
  47. //触发事件
  48. table.on('toolbar(contact)', function (obj) {
  49. var checkStatus = table.checkStatus(obj.config.id);
  50. switch (obj.event) {
  51. case 'add':
  52. parent.layui.tool.side('/admin/project.contact/add_proprietor?project_id=' + project_id); // 项目id
  53. break;
  54. }
  55. });
  56. table.on('tool(contact)', function (obj) {
  57. var data = obj.data; //获得当前行数据
  58. if (obj.event === 'detail') { //查看
  59. let url = '/admin/project.contact/view_proprietor?id=' + data.id;// 项目id
  60. parent.layui.tool.side(url);
  61. }
  62. if (obj.event === 'edit') { //查看
  63. let url = '/admin/project.contact/edit_proprietor?id=' + data.id;// 项目id
  64. parent.layui.tool.side(url);
  65. }
  66. if (obj.event === 'del') {
  67. layer.prompt({title: '请输入<span style="color: red">删除</span>原因', formType: 2,area: ['35vw', '15vw']}, function(text, index){
  68. let callback = function (e) {
  69. window.location.reload()
  70. layer.msg(e.msg);
  71. setTimeout(function (){
  72. layer.close(index);
  73. },2000)
  74. }
  75. tool.post("/admin/project.contact/delete_proprietor", {id: data.id ,remark:text}, callback);// 项目id
  76. });
  77. }
  78. })
  79. }
  80. </script>